package com.ruoyi.system.outto.goods.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.exception.GlobalException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.V2.gameAttr.mapper.GameAttributeMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoImgMapper;
import com.ruoyi.system.V2.goodInfo.mapper.GoodsInfoMapper;
import com.ruoyi.system.V2.inter.mapper.ArtRecMapper;
import com.ruoyi.system.model.domain.ArtRec;
import com.ruoyi.system.model.domain.GameAttribute;
import com.ruoyi.system.model.domain.GoodsInfoImg;
import com.ruoyi.system.model.domain.SalePartner;
import com.ruoyi.system.model.dto.GoodsInfoAndAttrValueDto;
import com.ruoyi.system.model.mapper.AccountInfoMapper;
import com.ruoyi.system.model.mapper.InfoImgMapper;
import com.ruoyi.system.outto.core.LCConstant;
import com.ruoyi.system.outto.dto.LSHENConstant;
import com.ruoyi.system.outto.game.CommonApi;
import com.ruoyi.system.outto.goods.NEWLSHENAPI;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author lz
 * @version 1.0
 * @date 2022/6/5 16:19
 */
@Slf4j
@Service
public class NEWLSHENAPIImpl implements NEWLSHENAPI {

    @Resource
    private InfoImgMapper infoImgMapper;
    @Resource
    private GoodsInfoMapper goodsInfoMapper;
    @Resource
    private GoodsInfoImgMapper goodsInfoImgMapper;
    @Resource
    private GameAttributeMapper gameAttributeMapper;
    @Value("${desc.title}")
    private String descTitle;
    private SalePartner salePartner;
    @Resource
    private CommonApi commonApi;

    @Resource
    private ArtRecMapper artRecMapper;
    private static String baseUrl = "http://test-www.leishenshangcheng.com/webapi";

    @Resource
    private AccountInfoMapper accountInfoMapper;


    @Override
    public AjaxResult addGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {
        String path = "/apiProduct/push";
        this.salePartner = salePartner;
        Map<String, Object> result = new HashMap<>();
        Map<String, Object> params = params(goodsInfoAndAttrValueDto);
        log.info("雷神添加接口请求参数={}", JSONObject.toJSONString(params));
        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);
        String response = HttpUtils.doPostForm(salePartner.getTwoOther() + path, params,header);
        log.info("雷神添加接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);
        if (!"true".equals(resultJson.getString("success"))&&!resultJson.getString("retCode").equals("goods_40022")) {
            result.put("code", 500);
        } else {
            ArtRec artRecreq = new ArtRec();
            artRecreq.setConfig(salePartner.getId());
            artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
            List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
            String goodsNo = "";
            if(resultJson.getString("retCode").equals("100")) {
                JSONObject data = resultJson.getJSONObject("retData");
                goodsNo = data.getString("goodsNo");
                if (CollectionUtils.isNotEmpty(artRecs)) {
                    artRecs.get(0).setOutid(goodsNo);
                    artRecMapper.updateArtRec(artRecs.get(0));
                } else {
                    artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
                    artRecreq.setCreateId(goodsInfoAndAttrValueDto.getCreateId());
                    artRecreq.setType(LCConstant.interAdd);
                    artRecreq.setConfig(salePartner.getId());
                    artRecreq.setSaleCode(salePartner.getSaleName());
                    artRecreq.setOutid(goodsNo);
                    artRecMapper.insertArtRec(artRecreq);
                }
            }else{
                String[] ids = resultJson.getString("retMsg").split(",");
                goodsNo = ids[1];
                if (CollectionUtils.isNotEmpty(artRecs)) {
                    artRecs.get(0).setOutid(goodsNo);
                    artRecMapper.updateArtRec(artRecs.get(0));
                } else {
                    artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
                    artRecreq.setCreateId(goodsInfoAndAttrValueDto.getCreateId());
                    artRecreq.setType(LCConstant.interAdd);
                    artRecreq.setConfig(salePartner.getId());
                    artRecreq.setSaleCode(salePartner.getSaleName());
                    artRecreq.setOutid(goodsNo);
                    artRecMapper.insertArtRec(artRecreq);
                }
            }
            result.put("code", 200);
            //上架
            up(goodsNo,salePartner);
        }

        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("data"));
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult editGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner salePartner) {

        String path = "/apiProduct/edit";
        this.salePartner = salePartner;
        Map<String, Object> result = new HashMap<>();

        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);

        Map<String, Object> map = new HashMap<>();

        List<Map<String, Object>> goodsList = new ArrayList<>();
//        goodsInfoAndAttrValueDto.setDes("xyr" + accountInfo.getId() + " " + accountInfo.getLevel() + accountInfo.getDes());
        Map<String, Object> params = new HashMap<>();
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(salePartner.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        if(CollectionUtils.isEmpty(artRecs)){
            throw new GlobalException("当前账号未推送，不可编辑");
        }
        params.put("goodsNo",artRecs.get(0).getOutid());
        BigDecimal bigDecimal = commonApi.addPrice(goodsInfoAndAttrValueDto.getPrice(),  this.salePartner.getSeleep());
        commonApi.setPrice(bigDecimal,goodsInfoAndAttrValueDto.getId(), this.salePartner);
        params.put("salePrice", bigDecimal);
        params.put("stock", "1");
        params.put("compensation", "1");
        String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
        List<JSONObject> goodsAttrList = new ArrayList<>();
        GameAttribute gameFieldName = null;
        if(Objects.equals("王者荣耀", goodsInfoAndAttrValueDto.getGameName())) {
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
        }
        if(Objects.equals("和平精英", goodsInfoAndAttrValueDto.getGameName())) {
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("原神")){
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("英雄联盟")){
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("枪战王者")){
            gameFieldName = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }
        String goodsTitle = "";
        String goodsDesc = "";
        if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getDes())){
            goodsTitle = goodsInfoAndAttrValueDto.getDes().length() > 130 ? goodsInfoAndAttrValueDto.getDes().substring(0, 130) : goodsInfoAndAttrValueDto.getDes();
            goodsDesc = goodsInfoAndAttrValueDto.getDes().length()>4800?goodsInfoAndAttrValueDto.getDes().substring(0,4800):goodsInfoAndAttrValueDto.getDes();
        }else if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitle())){
            goodsTitle = goodsInfoAndAttrValueDto.getTitle().length() > 130 ? goodsInfoAndAttrValueDto.getTitle().substring(0, 130) : goodsInfoAndAttrValueDto.getTitle();
            goodsDesc = goodsInfoAndAttrValueDto.getTitle().length()>4800?goodsInfoAndAttrValueDto.getTitle().substring(0,4800):goodsInfoAndAttrValueDto.getTitle();
        }else{
            throw new GlobalException("标题不能为空");
        }
        params.put("goodsTitle", "【"+descTitle+"_"+goodsInfoAndAttrValueDto.getId()+"】"+goodsTitle);
        params.put("goodsDesc", "【"+descTitle+"_"+goodsInfoAndAttrValueDto.getId()+"】"+goodsDesc);
        GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
        goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
        goodsInfoImg.setType(Constants.STR_1);
        List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
        int i = 0;
        List<Object> goodsPicList = new ArrayList<>();
        JSONObject picOne = new JSONObject();
        picOne.put("picUrl", goodsInfoAndAttrValueDto.getTitleImg()==null||goodsInfoAndAttrValueDto.getTitleImg().equals("")? LCConstant.defaultImg:goodsInfoAndAttrValueDto.getTitleImg());
        picOne.put("sort", i);
        goodsPicList.add(picOne);
        for (GoodsInfoImg img : infoImgs) {
            i++;
            JSONObject pic = new JSONObject();
            pic.put("picUrl", img.getImgUrl());
            pic.put("sort", i);
            goodsPicList.add(pic);
        }
        params.put("goodsPicList", goodsPicList);

        params.put("imgUrl", goodsInfoAndAttrValueDto.getTitleImg()==null||goodsInfoAndAttrValueDto.getTitleImg().equals("")? LCConstant.defaultImg:goodsInfoAndAttrValueDto.getTitleImg());
        if (Objects.equals("枪战王者", goodsInfoAndAttrValueDto.getGameName())) {
            params.put("gameId", "73");
            if(goodsInfoAndAttrValueDto.getSystemName().contains("安卓")) {
                params.put("systemId", "76");
            }else{
                params.put("systemId", "77");
            }
            String regionals = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if (Objects.equals("安卓QQ",regionals)) {
                params.put("gameSysId", "76");
                params.put("gameServerId", "84");
            } else if (Objects.equals("安卓微信", regionals)) {
                params.put("gameSysId", "76");
                params.put("gameServerId", "85");
            } else if (Objects.equals("苹果微信", regionals)) {
                params.put("gameSysId", "77");
                params.put("gameServerId", "82");
            } else if (Objects.equals("苹果QQ", regionals)) {
                params.put("gameSysId", "77");
                params.put("gameServerId", "83");
            }
            String wzryxiyou = LSHENConstant.lsqzwz;
            JSONArray jsonArray = JSONArray.parseArray(wzryxiyou);
            for(Object o: jsonArray){
                if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                    JSONObject gzdj = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                    if (JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("贵族等级")) {
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for (Object p : jsonArray1) {
                            if(gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        gzdj.put("gameParentAttrId", 865);
                        String join = StringUtils.join(ids, ",");
                        gzdj.put("gameChildAttrId", join);
                        goodsAttrList.add(gzdj);
                    }
                    ids.clear();
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    JSONObject fcm = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    ids.add(864l);
                    fcm.put("gameParentAttrId", 862);
                    String join = StringUtils.join(ids, ",");
                    fcm.put("gameChildAttrId", join);
                    goodsAttrList.add(fcm);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("二次实名")){
                    JSONObject fcm = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    if(gameFieldName.getFieldName().contains("有修改人脸机会")) {
                        ids.add(860l);
                    }else{
                        ids.add(861l);
                    }
                    fcm.put("gameParentAttrId", 859);
                    String join = StringUtils.join(ids, ",");
                    fcm.put("gameChildAttrId", join);
                    goodsAttrList.add(fcm);
                }
            }

        }
        if (Objects.equals("王者荣耀", goodsInfoAndAttrValueDto.getGameName())) {

//            params.put("goodsTitle", goodsInfoAndAttrValueDto.getDes());
//            params.put("goodsTitle", descTitle + "||" + accountInfo.getId() + "【皮肤数量 " + accountInfo.getSkins() + "英雄数量 " + accountInfo.getHeroes() + "】");

            params.put("gameId", "67");
            params.put("systemId", "65");

            if (Objects.equals("安卓QQ", regional)) {

                params.put("gameSysId", "65");
                params.put("gameServerId", "55");


            } else if (Objects.equals("安卓微信", regional)) {

                params.put("gameSysId", "65");
                params.put("gameServerId", "56");

            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "66");
                params.put("gameServerId", "54");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "66");
                params.put("gameServerId", "53");
            } else {
                return null;
            }
            params.put("gameName", "【皮肤数量 " + goodsInfoAndAttrValueDto.getF8() + "英雄数量 " + goodsInfoAndAttrValueDto.getF7() + "】");

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            List<Long> ids = new ArrayList<>();
            String wzryxiyou = LSHENConstant.wzryxiyou;
            List<JSONObject> jsonObjects = JSONObject.parseArray(wzryxiyou, JSONObject.class);
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())){
                List<GameAttribute> gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                for(GameAttribute gameAttribute1 :gameAttributes) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 229);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }else{
                xiyouwz.put("gameParentAttrId", 229);
                xiyouwz.put("gameChildAttrId", 1205);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();


            JSONObject duanwei = new JSONObject();
            String duanweiStr = LSHENConstant.duanwei;
            jsonObjects = JSONObject.parseArray(duanweiStr, JSONObject.class);
            ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())) {
                GameAttribute gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }else{
                ids.add(218l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                duanwei.put("gameParentAttrId", 217);
                String join = StringUtils.join(ids, ",");
                duanwei.put("gameChildAttrId", join);
                goodsAttrList.add(duanwei);
            }
            ids.clear();


            //皮肤
            JSONObject pifujson = new JSONObject();
            pifujson.put("gameParentAttrId", 212);
            pifujson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF8());
//            if (accountInfo.getHeroes() > -1 && accountInfo.getHeroes() <= 20) {
//                ids.add(213l);
//            }
//            if (accountInfo.getHeroes() > 21 && accountInfo.getHeroes() <= 50) {
//                ids.add(214l);
//            }
//            if (accountInfo.getHeroes() > 51 && accountInfo.getHeroes() <= 80) {
//                ids.add(215l);
//            }
//            if (accountInfo.getHeroes() > 80 && accountInfo.getHeroes() <= 9999999) {
//                ids.add(216l);
//            }
//            if (CollectionUtils.isNotEmpty(ids)) {
//                String join = StringUtils.join(ids, ",");
//                pifujson.put("gameChildAttrId", join);
//            }
            goodsAttrList.add(pifujson);
            ids.clear();

            //贵族
            JSONObject guizujson = new JSONObject();
            GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));

            if (gameAttribute1.getFieldName().contains("V1") ||
                    gameAttribute1.getFieldName().contains("V2") ||
                    gameAttribute1.getFieldName().contains("V3") ||
                    gameAttribute1.getFieldName().contains("V4") ||
                    gameAttribute1.getFieldName().contains("V5") ||
                    gameAttribute1.getFieldName().contains("V6")
            ) {
                ids.add(208l);
            }

            if (gameAttribute1.getFieldName().contains("V7")) {
                ids.add(209l);
            }
            if (gameAttribute1.getFieldName().contains("V8")) {
                ids.add(210l);
            }
            if (gameAttribute1.getFieldName().contains("V9")) {
                ids.add(211l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                guizujson.put("gameParentAttrId", 207);
                String join = StringUtils.join(ids, ",");
                guizujson.put("gameChildAttrId", join);
                goodsAttrList.add(guizujson);
            }
            ids.clear();


            JSONObject skinjson = new JSONObject();
//            if (accountInfo.getHeroes() > -1 && accountInfo.getHeroes() <= 50) {
//                ids.add(203l);
//            }
//            if (accountInfo.getHeroes() > 51 && accountInfo.getHeroes() <= 150) {
//                ids.add(204l);
//            }
//            if (accountInfo.getHeroes() > 150 && accountInfo.getHeroes() <= 300) {
//                ids.add(205l);
//            }
//            if (accountInfo.getHeroes() > 300 && accountInfo.getHeroes() <= 9999999) {
//                ids.add(206l);
//            }
            if (CollectionUtils.isNotEmpty(ids)) {
                skinjson.put("gameParentAttrId", 202);
//                String join = StringUtils.join(ids, ",");
                skinjson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF7());
                goodsAttrList.add(skinjson);
            }
            ids.clear();


            //沉迷
            JSONObject chenmijson = new JSONObject();
            chenmijson.put("gameParentAttrId", 199);
            ids.add(201l);
            if (CollectionUtils.isNotEmpty(ids)) {
                String join = StringUtils.join(ids, ",");
                chenmijson.put("gameChildAttrId", join);
            }
            goodsAttrList.add(chenmijson);

            ids.clear();

            JSONObject shiming = new JSONObject();
            if ("可二次实名".contains(gameFieldName.getFieldName())) {
                ids.add(197l);
            } else {
                ids.add(198l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 196);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();


            JSONObject wzxiyouskinjson = new JSONObject();
            String wzryxiyouskins = LSHENConstant.wzryxiyouskins;
            String pfIds = "";

            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
            List<GameAttribute> gameAttributessss = getGameAttributs(pfIds);
            jsonObjects = JSONObject.parseArray(wzryxiyouskins, JSONObject.class);
            ids = new ArrayList<>();
            for(GameAttribute gameAttribute2 : gameAttributessss) {
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute2.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiyouskinjson.put("gameParentAttrId", 142);
                String join = StringUtils.join(ids, ",");
                wzxiyouskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiyouskinjson);
            }else{
                wzxiyouskinjson.put("gameParentAttrId", 142);
                wzxiyouskinjson.put("gameChildAttrId", 1203);
                goodsAttrList.add(wzxiyouskinjson);
            }
            ids.clear();

            //限定皮肤
            JSONObject wzxiandingskinjson = new JSONObject();
            String xiandingskins = LSHENConstant.xiandingskins;

            jsonObjects = JSONObject.parseArray(xiandingskins, JSONObject.class);
            ids = new ArrayList<>();
            for(GameAttribute gameAttribute2 : gameAttributessss) {
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute2.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiandingskinjson.put("gameParentAttrId", 28);
                String join = StringUtils.join(ids, ",");
                wzxiandingskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiandingskinjson);
            }else{
                wzxiandingskinjson.put("gameParentAttrId", 28);
                wzxiandingskinjson.put("gameChildAttrId", 1202);
                goodsAttrList.add(wzxiandingskinjson);
            }
            ids.clear();
            //星元皮肤
            JSONObject wzxingyuanskinjson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())){
                List<GameAttribute> gameAttributesss = getGameAttributs(goodsInfoAndAttrValueDto.getF10());
                String wzxingyuanskins = LSHENConstant.wzxingyuanskins;

                jsonObjects = JSONObject.parseArray(wzxingyuanskins, JSONObject.class);
                ids = new ArrayList<>();
                for(GameAttribute gameAttribute2 : gameAttributesss) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute2.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    wzxingyuanskinjson.put("gameParentAttrId", 16);
                    String join = StringUtils.join(ids, ",");
                    wzxingyuanskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzxingyuanskinjson);
                }else{
                    wzxingyuanskinjson.put("gameParentAttrId", 16);
                    wzxingyuanskinjson.put("gameChildAttrId", 1201);
                    goodsAttrList.add(wzxingyuanskinjson);
                }
                ids.clear();
            }else{
                wzxingyuanskinjson.put("gameParentAttrId", 16);
                wzxingyuanskinjson.put("gameChildAttrId", 1201);
                goodsAttrList.add(wzxingyuanskinjson);
            }

            //典藏皮肤
            JSONObject wzdiancnagskinjson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF9())){
                List<GameAttribute> gameAttributesss = getGameAttributs(goodsInfoAndAttrValueDto.getF9());
                String diancangskins = LSHENConstant.diancangskins;

                jsonObjects = JSONObject.parseArray(diancangskins, JSONObject.class);
                ids = new ArrayList<>();
                for(GameAttribute gameAttribute2 : gameAttributesss) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute2.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    wzdiancnagskinjson.put("gameParentAttrId", 1);
                    String join = StringUtils.join(ids, ",");
                    wzdiancnagskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzdiancnagskinjson);
                }else{
                    wzdiancnagskinjson.put("gameParentAttrId", 1);
                    wzdiancnagskinjson.put("gameChildAttrId", 1204);
                    goodsAttrList.add(wzdiancnagskinjson);
                }
                ids.clear();
            }else{
                wzdiancnagskinjson.put("gameParentAttrId", 1);
                wzdiancnagskinjson.put("gameChildAttrId", 1204);
                goodsAttrList.add(wzdiancnagskinjson);
            }

        }
        if (Objects.equals("和平精英", goodsInfoAndAttrValueDto.getGameName())) {
//            params.put("goodsTitle", descTitle + "||" + accountInfo.getId() + "【枪皮数量 " + accountInfo.getGuns() + "套装数量 " + accountInfo.getSuit() + "】");
            String gameName = goodsInfoAndAttrValueDto.getDes().length()>100?goodsInfoAndAttrValueDto.getDes().substring(0,90):goodsInfoAndAttrValueDto.getDes();

            params.put("gameId", "68");
            if(goodsInfoAndAttrValueDto.getSystemName().contains("安卓")) {
                params.put("systemId", "67");
            }else{
                params.put("systemId", "68");
            }
            if (Objects.equals("安卓QQ", regional)) {
                params.put("gameSysId", "67");
                params.put("gameServerId", "59");
            } else if (Objects.equals("安卓微信", regional)) {

                params.put("gameSysId", "67");
                params.put("gameServerId", "60");
            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "68");
                params.put("gameServerId", "57");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "68");
                params.put("gameServerId", "58");
            } else {
                return null;
            }
            params.put("gameName", gameName);

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            String wzryxiyou = LSHENConstant.xiyoutaozhuang;
            List<JSONObject> jsonObjects = JSONObject.parseArray(wzryxiyou, JSONObject.class);
            List<Long> ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                List<GameAttribute> gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                for (GameAttribute gameAttribute : gameAttributes) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 389);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();

            JSONObject duanwei = new JSONObject();
            String duanweiStr = LSHENConstant.hpduanwei;
            jsonObjects = JSONObject.parseArray(duanweiStr, JSONObject.class);
            ids = new ArrayList<>();
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF15())){
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF15()));
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute1.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    duanwei.put("gameParentAttrId", 267);
                    String join = StringUtils.join(ids, ",");
                    duanwei.put("gameChildAttrId", join);
                    goodsAttrList.add(duanwei);
                }
                ids.clear();
            }else {
                throw new GlobalException("段位为空");
            }


            //皮肤
            JSONObject pifujson = new JSONObject();
//            if (accountInfo.getGuns() > -1 && accountInfo.getGuns() <= 5) {
//                ids.add(261l);
//            }
//            if (accountInfo.getGuns() > 6 && accountInfo.getGuns() <= 10) {
//                ids.add(262l);
//            }
//            if (accountInfo.getGuns() > 11 && accountInfo.getGuns() <= 20) {
//                ids.add(263l);
//            }
//            if (accountInfo.getGuns() > 21 && accountInfo.getGuns() <= 30) {
//                ids.add(264l);
//            }
//            if (accountInfo.getGuns() > 31 && accountInfo.getGuns() <= 45) {
//                ids.add(265l);
//            }
//            if (accountInfo.getGuns() > 45 && accountInfo.getGuns() <= 9999999) {
//                ids.add(266l);
//            }
            pifujson.put("gameParentAttrId", 260);
            pifujson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF9());
            goodsAttrList.add(pifujson);
            ids.clear();

            //贵族
            JSONObject guizujson = new JSONObject();
            GameAttribute gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
            if(Objects.nonNull(gameAttribute)) {
                if (gameAttribute.getFieldName().contains("V1") ||
                        gameAttribute.getFieldName().contains("V2") ||
                        gameAttribute.getFieldName().contains("V3") ||
                        gameAttribute.getFieldName().contains("V4") ||
                        gameAttribute.getFieldName().contains("V5") ||
                        gameAttribute.getFieldName().contains("V6")
                ) {
                    ids.add(208l);
                }
                if (gameAttribute.getFieldName().contains("V7")) {
                    ids.add(209l);
                }
                if (gameAttribute.getFieldName().contains("V8")) {
                    ids.add(210l);
                }
                if (gameAttribute.getFieldName().contains("V9")) {
                    ids.add(211l);
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                String join = StringUtils.join(ids, ",");
                guizujson.put("gameChildAttrId", join);
                guizujson.put("gameParentAttrId", 207);
                goodsAttrList.add(guizujson);
            }
            ids.clear();

            JSONObject skinjson = new JSONObject();
//            if (accountInfo.getSuit() > -1 && accountInfo.getSuit() <= 50) {
//                ids.add(245l);
//            }
//            if (accountInfo.getSuit() > 51 && accountInfo.getSuit() <= 100) {
//                ids.add(246l);
//            }
//            if (accountInfo.getSuit() > 101 && accountInfo.getSuit() <= 150) {
//                ids.add(247l);
//            }
//            if (accountInfo.getSuit() > 151 && accountInfo.getSuit() <= 250) {
//                ids.add(248l);
//            }
//            if (accountInfo.getSuit() > 251 && accountInfo.getSuit() <= 351) {
//                ids.add(249l);
//            }
//            if (accountInfo.getSuit() > 351 && accountInfo.getSuit() <= 450) {
//                ids.add(250l);
//            }
//            if (accountInfo.getSuit() > 450 && accountInfo.getSuit() <= 99999999) {
//                ids.add(251l);
//            }

            skinjson.put("gameParentAttrId", 244);
            skinjson.put("gameChildAttrId", goodsInfoAndAttrValueDto.getF8());
            goodsAttrList.add(skinjson);

            ids.clear();

            //沉迷
            JSONObject chenmijson = new JSONObject();
            ids.add(243l);
            if (CollectionUtils.isNotEmpty(ids)) {
                chenmijson.put("gameParentAttrId", 241);
                String join = StringUtils.join(ids, ",");
                chenmijson.put("gameChildAttrId", join);
                goodsAttrList.add(chenmijson);
            }
            ids.clear();

            JSONObject shiming = new JSONObject();
            if ("可二次实名".contains(gameFieldName.getFieldName())) {
                ids.add(239l);
            } else {
                ids.add(240l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 238);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();

            JSONObject wzxiyouskinjson = new JSONObject();
            String wzryxiyouskins = LSHENConstant.remenqix;
            jsonObjects = JSONObject.parseArray(wzryxiyouskins, JSONObject.class);
            ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF1());
                for (GameAttribute gameAttribute2 : gameAttributeList) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute2.getFieldName().replace("-", "").contains(subAttrName.replace("/", ""))) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiyouskinjson.put("gameParentAttrId", 334);
                String join = StringUtils.join(ids, ",");
                wzxiyouskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiyouskinjson);
            }
            ids.clear();

            //限定皮肤
            JSONObject wzxiandingskinjson = new JSONObject();
            String wzryxiandingskins = LSHENConstant.remzju;
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                List<GameAttribute> gameAttributeLists = getGameAttributs(goodsInfoAndAttrValueDto.getF2());
                jsonObjects = JSONObject.parseArray(wzryxiandingskins, JSONObject.class);
                ids = new ArrayList<>();
                String fildName = "";
                for (GameAttribute gameAttribute3 : gameAttributeLists) {
                    if (gameAttribute3.getFieldName().contains("玛莎拉蒂Ghibli(粉)")) {
                        fildName = "玛莎拉蒂粉";
                    }
                    if (gameAttribute3.getFieldName().contains("玛莎拉蒂Ghibli(金)")) {
                        fildName = "玛莎拉蒂金";
                    }
                    if (gameAttribute3.getFieldName().contains("玛莎拉蒂Ghibli(蓝)")) {
                        fildName = "玛莎拉蒂蓝";
                    }
                    if (gameAttribute3.getFieldName().contains("合金龙骨")) {
                        fildName = gameAttribute3.getFieldName().replace("(", "").replace(")", "");
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Roadster(水滴蓝)")) {
                        fildName = "特斯拉水滴蓝";
                    }
                    if (gameAttribute3.getFieldName().contains("阿斯顿·马丁DB")) {
                        fildName = gameAttribute3.getFieldName().replace("·", "").replace("DB", "").replace("(", "").replace(")", "");
                    }
                    if (gameAttribute3.getFieldName().contains("双人摩托-梦幻火箭")) {
                        fildName = gameAttribute3.getFieldName().replace("-", "");
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼AventadorSVJ(翡翠绿)")) {
                        fildName = "兰博基尼SVJ(绿)";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Roadster")) {
                        fildName = gameAttribute3.getFieldName().replace("Roadster(", "").replace(")", "");
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼Estoque(银翼灰)")) {
                        fildName = "兰博基尼Est( 灰)";
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼Est(金)")) {
                        fildName = "兰博基尼Estoque(炫光金)";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Cybertruck")) {
                        fildName = gameAttribute3.getFieldName().replace("Cybertruck(", "").replace(")", "");
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉ModelX-珍珠白")) {
                        fildName = "Model X白";
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼URUS(明艳黄)")) {
                        fildName = "兰博基尼SUV(黄)";
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼URUS(炫光金)")) {
                        fildName = "兰博基尼SUV(金)";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Model3-珍珠白")) {
                        fildName = "Model 3白";
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼AventadorSVJ(尊享铂)")) {
                        fildName = "兰博基尼SVJ(铂)";
                    }
                    if (gameAttribute3.getFieldName().contains("双刃魅影")) {
                        fildName = gameAttribute3.getFieldName().split("-")[1];
                    }
                    if (gameAttribute3.getFieldName().contains("兰博基尼Estoque(尊享铂)")) {
                        fildName = "兰博基尼Est(铂)";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉ModelX-冷光银")) {
                        fildName = "Model X银";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉ModelX-奇幻紫")) {
                        fildName = "Model X紫";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Model3-冷光银")) {
                        fildName = "Model 3银";
                    }

                    if (gameAttribute3.getFieldName().contains("兰博基尼URUS(尊享铂)")) {
                        fildName = "兰博基尼SUV(铂)";
                    }
                    if (gameAttribute3.getFieldName().contains("特斯拉Model3-奇幻紫")) {
                        fildName = "Model 3紫";
                    }
                    if (gameAttribute3.getFieldName().contains("路特斯E")) {
                        fildName = gameAttribute3.getFieldName().replace("(", "").replace(")", "");

                    }
                    if (gameAttribute3.getFieldName().contains("快艇-塞莎KL27(鲸之蓝)")) {
                        fildName = "快艇塞拉鲸之蓝";
                    }
                    if (gameAttribute3.getFieldName().contains("快艇-塞莎KL27(霓虹粉)")) {
                        fildName = "快艇塞拉霓虹粉";
                    }
                    if (gameAttribute3.getFieldName().contains("快艇-塞莎KL27(深潜蓝)")) {
                        fildName = "快艇塞拉深潜蓝";
                    }
                    if (gameAttribute3.getFieldName().contains("快艇-塞莎KL27(深潜蓝)")) {
                        fildName = "快艇塞拉深潜蓝";
                    }
                    if (gameAttribute3.getFieldName().contains("快艇-塞莎KL27(深潜蓝)")) {
                        fildName = "快艇塞拉深潜蓝";
                    }
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (subAttrName.contains("路特斯E")) {
                            subAttrName = subAttrName.replace("(", "").replace(")", "").replace("（", "").replace("）", "");
                        }
                        if (StringUtils.isEmpty(fildName)) {
                            fildName = gameAttribute3.getFieldName();
                        }
                        if (fildName.contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiandingskinjson.put("gameParentAttrId", 276);
                String join = StringUtils.join(ids, ",");
                wzxiandingskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiandingskinjson);
            }
        }
        if (Objects.equals("原神", goodsInfoAndAttrValueDto.getGameName())) {

//            params.put("goodsTitle", gameName);

            params.put("gameId", "69");

            params.put("gameSysId", "70");
            if (goodsInfoAndAttrValueDto.getCarrierName().contains("游戏官方")) {
                params.put("gameServerId", "65");
            }
            if (goodsInfoAndAttrValueDto.getCarrierName().contains("哔哩哔哩")) {
                params.put("gameServerId", "66");
            }
//            params.put("gameName", goodsInfoAndAttrValueDto.getGameName());

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            String ys5xing = LSHENConstant.ys5xing;
            List<JSONObject> jsonObjects = JSONObject.parseArray(ys5xing, JSONObject.class);
            List<Long> ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                List<GameAttribute> jsList = getGameAttributs(goodsInfoAndAttrValueDto.getF11());
                for (GameAttribute gameAttribute1 : jsList) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 543);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();

            //皮肤
            JSONObject pifujson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())) {
                String[] wqs = goodsInfoAndAttrValueDto.getF17().split(",");
                if (wqs.length > -1 && wqs.length <= 5) {
                    ids.add(538l);
                }
                if (wqs.length >= 6 && wqs.length <= 10) {
                    ids.add(539l);
                }
                if (wqs.length >= 11 && wqs.length <= 20) {
                    ids.add(540l);
                }
                if (wqs.length >= 21 && wqs.length <= 30) {
                    ids.add(541l);
                }
                if (wqs.length >= 31 && wqs.length <= 9999999) {
                    ids.add(542l);
                }
            }else{
                ids.add(538l);
            }
            pifujson.put("gameParentAttrId", 537);
            if(ids.size()>0) {
                pifujson.put("gameChildAttrValue", ids.get(0));
            }else{
                pifujson.put("gameChildAttrValue", 538l);
            }
            ids.clear();
            //5星角色数量
            JSONObject juese = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                String[] jss = goodsInfoAndAttrValueDto.getF11().split(",");
                if (jss.length > -1 && jss.length <= 5) {
                    ids.add(532l);
                }
                if (jss.length >= 6 && jss.length <= 10) {
                    ids.add(533l);
                }
                if (jss.length >= 11 && jss.length <= 15) {
                    ids.add(534l);
                }
                if (jss.length >= 15 && jss.length <= 25) {
                    ids.add(535l);
                }
                if (jss.length >= 25 && jss.length <= 9999999) {
                    ids.add(536l);
                }
            }else{
                ids.add(532l);
            }
            juese.put("gameParentAttrId", 531);
            juese.put("gameChildAttrValue", ids.get(0));
            goodsAttrList.add(juese);
            ids.clear();

            GameAttribute gameAttribute=gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
            JSONObject shiming = new JSONObject();
            if (!Objects.equals("可修改邮箱", gameAttribute.getFieldName())) {
                ids.add(526l);
            } else {
                ids.add(525l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 524);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();
        }
        if (Objects.equals("英雄联盟", goodsInfoAndAttrValueDto.getGameName())) {
            params.put("goodsTitle", descTitle + "||" + goodsInfoAndAttrValueDto.getId() + "【英雄数量 " + goodsInfoAndAttrValueDto.getF11() + "V武器数量 " + goodsInfoAndAttrValueDto.getF8() + "】");

            params.put("gameId", "71");
            params.put("gameSysId", "71");

            String lccLOLr = LSHENConstant.lolr;
            JSONObject lOLrObject = JSONObject.parseObject(lccLOLr);
            String lOLrObjectArr = lOLrObject.getString("retData");
            List<JSONObject> rList = JSONObject.parseArray(lOLrObjectArr, JSONObject.class);
            for (JSONObject jsonObject : rList) {
                String gameServerVoList = jsonObject.getString("gameServerVoList");
                List<JSONObject> serverVoListJson = JSONObject.parseArray(gameServerVoList, JSONObject.class);
                for (JSONObject areaJson : serverVoListJson) {

                    String serverId = areaJson.getString("serverId");

                    String gameAreaVoList = areaJson.getString("gameAreaVoList");
                    List<JSONObject> areaJsonList = JSONObject.parseArray(gameAreaVoList, JSONObject.class);
                    for (JSONObject gameArea : areaJsonList) {
                        String areaName = gameArea.getString("areaName");
                        if (Objects.equals(gameFieldName.getFieldName(), areaName)) {
                            params.put("gameServerId", serverId);
                            params.put("gameAreaId", gameArea.getString("areaId"));
                        }
                    }
                }
            }
            params.put("gameName", goodsInfoAndAttrValueDto.getDes().length()>100?goodsInfoAndAttrValueDto.getDes().substring(0,90):goodsInfoAndAttrValueDto.getDes());
            String pfIds = "";
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF13());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF14());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF16());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF17());
            List<GameAttribute> gameAttributes = getGameAttributs(pfIds);
            String lsyxlm = LSHENConstant.lsyxlm;
            JSONArray jsonArray = JSONArray.parseArray(lsyxlm);
            JSONObject xiyouwz = new JSONObject();
            for(Object o : jsonArray){
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("海克斯皮肤")){
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 688);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("至臻皮肤")){
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 661);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("稀有皮肤")){
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 653);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("炫彩皮肤数量")){
                    List<Long> ids = new ArrayList<>();
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())){
                        if(Integer.parseInt(goodsInfoAndAttrValueDto.getF5())>=1&&Integer.parseInt(goodsInfoAndAttrValueDto.getF5())<=200){
                            ids.add(648l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF5())>=201&&Integer.parseInt(goodsInfoAndAttrValueDto.getF5())<=500){
                            ids.add(649l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF5())>=501&&Integer.parseInt(goodsInfoAndAttrValueDto.getF5())<=1000){
                            ids.add(650l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF5())>=1001&&Integer.parseInt(goodsInfoAndAttrValueDto.getF5())<=2000){
                            ids.add(651l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF5())>=2000&&Integer.parseInt(goodsInfoAndAttrValueDto.getF5())<=9999999){
                            ids.add(652l);
                        }
                    }else{
                        ids.add(648l);
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 647);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("单双排段位")){
                    List<Long> ids = new ArrayList<>();
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(Object p : jsonArray1){
                            if(JSONObject.parseObject(p.toString()).getString("subAttrName").equals(gameAttribute1.getFieldName())){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            xiyouwz.put("gameParentAttrId", 637);
                            String join = StringUtils.join(ids, ",");
                            xiyouwz.put("gameChildAttrId", join);
                            goodsAttrList.add(xiyouwz);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    List<Long> ids = new ArrayList<>();
                    ids.add(636l);
                    String join = StringUtils.join(ids, ",");
                    xiyouwz.put("gameParentAttrId", 634);
                    xiyouwz.put("gameChildAttrId", join);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("英雄数量")){
                    List<Long> ids = new ArrayList<>();
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                        if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=1&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=30){
                            ids.add(629l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=31&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=60){
                            ids.add(630l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=61&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=100){
                            ids.add(631l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=101&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=150){
                            ids.add(632l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=150&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=9999999){
                            ids.add(633l);
                        }
                    }else{
                        ids.add(629l);
                    }
                    String join = StringUtils.join(ids, ",");
                    xiyouwz.put("gameParentAttrId", 628);
                    xiyouwz.put("gameChildAttrId", join);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("皮肤数量")){
                    List<Long> ids = new ArrayList<>();
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())){
                        if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=1&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=100){
                            ids.add(622l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=101&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=300){
                            ids.add(623l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=301&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=500){
                            ids.add(624l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=501&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=800){
                            ids.add(625l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=801&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=1200){
                            ids.add(626l);
                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=1201&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=9999999){
                            ids.add(627l);
                        }
                    }else {
                        ids.add(622l);
                    }
                    String join = StringUtils.join(ids, ",");
                    xiyouwz.put("gameParentAttrId", 621);
                    xiyouwz.put("gameChildAttrId", join);
                }
            }
        }
        if (Objects.equals("穿越火线", goodsInfoAndAttrValueDto.getGameName())) {

            String gameName = "";
            if (goodsInfoAndAttrValueDto.getDes().length() > 15) {
                gameName = goodsInfoAndAttrValueDto.getDes().substring(0, 100);
            } else {
                gameName = goodsInfoAndAttrValueDto.getDes();
            }

//            params.put("goodsTitle", descTitle + "||" + goodsInfoAndAttrValueDto.getId() + gameName);

            params.put("gameId", "72");

            params.put("gameSysId", "69");
            if (Objects.equals("东部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "61");
            }
            if (Objects.equals("南部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "62");
            }
            if (Objects.equals("西部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "63");
            }
            if (Objects.equals("北部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "64");
            }
            params.put("gameName", gameName);

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            String ys5xing = LSHENConstant.cfvq;
            List<GameAttribute> gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF13());
            List<Long> ids = new ArrayList<>();
            String fieldName = "";
            for(GameAttribute gameAttribute1 : gameAttributes) {
                List<JSONObject> jsonObjects = JSONObject.parseArray(ys5xing, JSONObject.class);
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if(gameAttribute1.getFieldName().contains("Scar Light-白虎")){
                        fieldName = "Scar-白虎";
                    }
                    if (fieldName.contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 467);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();

            JSONObject chenmi = new JSONObject();
            chenmi.put("gameParentAttrId", 443);
            chenmi.put("gameChildAttrId", 445);
            goodsAttrList.add(chenmi);

            ids.clear();
            JSONObject shiming = new JSONObject();
            if (Arrays.asList(LCConstant.haveTwoList).contains(gameFieldName.getFieldName())) {
                ids.add(441l);
            } else {
                ids.add(442l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 440);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }
            ids.clear();
        }
        if (Objects.equals("火影忍者", goodsInfoAndAttrValueDto.getGameName())) {
            params.put("gameId", "74");
            String regionals = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if (Objects.equals("安卓QQ", regionals)) {
                params.put("gameSysId", "73");
                params.put("gameServerId", "78");
            } else if (Objects.equals("安卓微信", regionals)) {
                params.put("gameSysId", "73");
                params.put("gameServerId", "79");
            } else if (Objects.equals("苹果微信", regionals)) {
                params.put("gameSysId", "74");
                params.put("gameServerId", "77");
            } else if (Objects.equals("苹果QQ", regionals)) {
                params.put("gameSysId", "74");
                params.put("gameServerId", "76");
            }
            String retData = JSONObject.parseObject(LSHENConstant.hyrz).getString("retData");
            JSONArray jsonArray = JSONArray.parseArray(retData);
            for(Object o : jsonArray){
                JSONObject jsonObject = new JSONObject();
                List<Long> ids = new ArrayList<>();
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("A忍")){
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())) {
                        List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF6());
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(GameAttribute gameAttribute1 : gameAttributeList){
                            for(Object p : jsonArray1){
                                if(JSONObject.parseObject(p.toString()).getString("subAttrName").contains(gameAttribute1.getFieldName())){
                                    Long id = jsonObject.getLong("id");
                                    ids.add(id);
                                }
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                            String join = StringUtils.join(ids, ",");
                            jsonObject.put("gameChildAttrId", join);
                            goodsAttrList.add(jsonObject);
                            JSONObject ashuliang = new JSONObject();
                            ashuliang.put("gameParentAttrId",745);
                            if(ids.size()>=1&&ids.size()<=10) {
                                ashuliang.put("gameChildAttrId", 746);
                            }else if(ids.size()>=11&&ids.size()<=20) {
                                ashuliang.put("gameChildAttrId", 747);
                            }else if(ids.size()>=21&&ids.size()<=40) {
                                ashuliang.put("gameChildAttrId", 748);
                            }else if(ids.size()>=41&&ids.size()<=60) {
                                ashuliang.put("gameChildAttrId", 749);
                            }else if(ids.size()>60) {
                                ashuliang.put("gameChildAttrId", 750);
                            }
                            goodsAttrList.add(ashuliang);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("S忍")){
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                        List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(GameAttribute gameAttribute1 : gameAttributeList){
                            for(Object p : jsonArray1){
                                if(JSONObject.parseObject(p.toString()).getString("subAttrName").contains(gameAttribute1.getFieldName())){
                                    Long id = jsonObject.getLong("id");
                                    ids.add(id);
                                }
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                            String join = StringUtils.join(ids, ",");
                            jsonObject.put("gameChildAttrId", join);
                            goodsAttrList.add(jsonObject);
                            JSONObject ashuliang = new JSONObject();
                            ashuliang.put("gameParentAttrId",739);
                            if(ids.size()>=1&&ids.size()<=5) {
                                ashuliang.put("gameChildAttrId", 740);
                            }else if(ids.size()>=6&&ids.size()<=10) {
                                ashuliang.put("gameChildAttrId", 741);
                            }else if(ids.size()>=11&&ids.size()<=20) {
                                ashuliang.put("gameChildAttrId", 742);
                            }else if(ids.size()>=21&&ids.size()<=30) {
                                ashuliang.put("gameChildAttrId", 743);
                            }else if(ids.size()>30) {
                                ashuliang.put("gameChildAttrId", 744);
                            }
                            goodsAttrList.add(ashuliang);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    jsonObject.put("gameChildAttrId", 730);
                    goodsAttrList.add(jsonObject);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("二次实名")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())){
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                        if(gameAttribute1.getFieldName().equals("可改二次")){
                            jsonObject.put("gameChildAttrId", 726);
                        }else{
                            jsonObject.put("gameChildAttrId", 727);
                        }
                    }else{
                        jsonObject.put("gameChildAttrId", 727);
                    }
                    goodsAttrList.add(jsonObject);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("VIP等级")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())){
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF8()));
                        if("V1,V2,V3".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 718);
                        }else if("V4,V5,V6".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 719);
                        }else if("V7,V8,V9".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 720);
                        }else if("V10,V11,V12".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 721);
                        }else if("V13".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 722);
                        }else if("V14".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 723);
                        }else if("V15".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 724);
                        }
                    }else{
                        jsonObject.put("gameChildAttrId", 718);
                    }
                    goodsAttrList.add(jsonObject);
                }
            }
        }
        params.put("compensation", "1");
        params.put("channelProductCode", goodsInfoAndAttrValueDto.getId());
        params.put("goodsType", "0");
        params.put("qty", "0");
        goodsList.add(params);
        map.put("goodsList", goodsList);

        String appKey = salePartner.getSaleKey();
        String appSecret = salePartner.getOther();
        String version = "1.0";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        Map<String, Object> paramReq = new HashMap<>();
        paramReq.put("appKey", appKey);
        paramReq.put("timestamp", timestamp);
        paramReq.put("version", version);
        paramReq.put("paramJson", JSONObject.toJSONString(map));
        log.info("paramJson={}", JSONObject.toJSONString(map));

        String sign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(map));
//        params.put("sign", sign);
        paramReq.put("sign", sign);


        log.info("雷神编辑接口请求参数={}", JSONObject.toJSONString(paramReq));
        String response = HttpUtils.doPostForm(salePartner.getTwoOther() + path, paramReq, header);
        log.info("雷神编辑接口返回参数={}", response);
        JSONObject resultJson = JSONObject.parseObject(response);

        if (!"true".equals(resultJson.getString("success"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }


        result.put("req", JSONObject.toJSONString(params));
        result.put("res", response);
        result.put("msg", resultJson.getString("data"));
        return AjaxResult.success(result);
    }


    private Map<String, Object> params(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto) {
        GameAttribute gameAttribute = null;
        if(Objects.equals("王者荣耀", goodsInfoAndAttrValueDto.getGameName())) {
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF16())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF16()));
        }
        if(Objects.equals("和平精英", goodsInfoAndAttrValueDto.getGameName())) {
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF10())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("原神")){
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF20())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("英雄联盟")){
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF1())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
        }
        if(goodsInfoAndAttrValueDto.getGameName().contains("穿越火线")){
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF3())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF3()));
        }
        if(Objects.equals("枪战王者", goodsInfoAndAttrValueDto.getGameName())) {
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF10())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF10()));
        }
        if(Objects.equals("地下城与勇士", goodsInfoAndAttrValueDto.getGameName())) {
            if(StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF1())){
                throw new GlobalException("实名情况不能为空");
            }
            gameAttribute = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF1()));
        }
        JSONObject params = new JSONObject();
        String goodsTitle = "";
        String goodsDesc = "";
        if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getDes())){
            goodsTitle = goodsInfoAndAttrValueDto.getDes().length() > 130 ? goodsInfoAndAttrValueDto.getDes().substring(0, 130) : goodsInfoAndAttrValueDto.getDes();
            goodsDesc = goodsInfoAndAttrValueDto.getDes().length()>4800?goodsInfoAndAttrValueDto.getDes().substring(0,4800):goodsInfoAndAttrValueDto.getDes();
        }else if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getTitle())){
            goodsTitle = goodsInfoAndAttrValueDto.getTitle().length() > 130 ? goodsInfoAndAttrValueDto.getTitle().substring(0, 130) : goodsInfoAndAttrValueDto.getTitle();
            goodsDesc = goodsInfoAndAttrValueDto.getTitle().length()>4800?goodsInfoAndAttrValueDto.getTitle().substring(0,4800):goodsInfoAndAttrValueDto.getTitle();
        }else{
            throw new GlobalException("标题不能为空");
        }
        params.put("goodsTitle", "【"+descTitle+"_"+goodsInfoAndAttrValueDto.getId()+"】"+goodsTitle);
        params.put("goodsDesc", "【"+descTitle+"_"+goodsInfoAndAttrValueDto.getId()+"】"+goodsDesc);
        GoodsInfoImg goodsInfoImg = new GoodsInfoImg();
        goodsInfoImg.setGoodsId(goodsInfoAndAttrValueDto.getId());
        goodsInfoImg.setType(Constants.STR_1);
        List<GoodsInfoImg> infoImgs = goodsInfoImgMapper.selectGoodsInfoImgList(goodsInfoImg);
        int i = 0;
        List<Object> goodsPicList = new ArrayList<>();
        JSONObject picOne = new JSONObject();
        picOne.put("picUrl", goodsInfoAndAttrValueDto.getTitleImg()==null||goodsInfoAndAttrValueDto.getTitleImg().equals("")? LCConstant.defaultImg:goodsInfoAndAttrValueDto.getTitleImg());
        picOne.put("sort", i);
        goodsPicList.add(picOne);
        for (GoodsInfoImg img : infoImgs) {
            i++;
            JSONObject pic = new JSONObject();
            pic.put("picUrl", img.getImgUrl());
            pic.put("sort", i);
            goodsPicList.add(pic);
        }
        params.put("goodsPicList", goodsPicList);

        params.put("imgUrl", goodsInfoAndAttrValueDto.getTitleImg()==null||goodsInfoAndAttrValueDto.getTitleImg().equals("")? LCConstant.defaultImg:goodsInfoAndAttrValueDto.getTitleImg());
        params.put("gameAccount", "111111");
        BigDecimal bigDecimal = commonApi.addPrice(goodsInfoAndAttrValueDto.getPrice(),  this.salePartner.getSeleep());
        commonApi.setPrice(bigDecimal,goodsInfoAndAttrValueDto.getId(), this.salePartner);
        params.put("salePrice", bigDecimal);
        BigDecimal subtract = new BigDecimal(100).subtract(new BigDecimal(80));
        BigDecimal divide = subtract.divide(new BigDecimal(100));
        BigDecimal subLinePrice =  bigDecimal.add(bigDecimal.multiply(divide));
        params.put("subLinePrice",subLinePrice);
//        params.put("subLinePrice",480.1);
        params.put("gameName", goodsInfoAndAttrValueDto.getGameName());

        List<JSONObject> goodsAttrList = new ArrayList<>();



        if (Objects.equals("王者荣耀", goodsInfoAndAttrValueDto.getGameName())) {
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();

            params.put("gameId", "67");
            params.put("systemId", "65");

            if (Objects.equals("安卓QQ", regional)) {

                params.put("gameSysId", "65");
                params.put("gameServerId", "55");


            } else if (Objects.equals("安卓微信", regional)) {

                params.put("gameSysId", "65");
                params.put("gameServerId", "56");

            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "66");
                params.put("gameServerId", "54");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "66");
                params.put("gameServerId", "53");
            } else {
                return null;
            }
            JSONObject xiyouwz = new JSONObject();


            String wzryxiyou = LSHENConstant.wzryxiyou;
            List<JSONObject> jsonObjects = JSONObject.parseArray(wzryxiyou, JSONObject.class);
            List<Long> ids = new ArrayList<>();
            List<GameAttribute> gameAttributes = new ArrayList<>();
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())){
                 gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
            }

            if (CollectionUtils.isNotEmpty(gameAttributes)){
                for(GameAttribute gameAttribute1 : gameAttributes) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 229);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }else{
                xiyouwz.put("gameParentAttrId", 229);
                xiyouwz.put("gameChildAttrId", 1205);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();


            JSONObject duanwei = new JSONObject();
            String duanweiStr = LSHENConstant.duanwei;
            List<GameAttribute> gameAttributess = new ArrayList<>();
            if (StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
                gameAttributess = getGameAttributs(goodsInfoAndAttrValueDto.getF3());
            }

            if (CollectionUtils.isNotEmpty(gameAttributess)){
                jsonObjects = JSONObject.parseArray(duanweiStr, JSONObject.class);
                ids = new ArrayList<>();
                for(GameAttribute gameAttribute1: gameAttributess) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }

            if (CollectionUtils.isNotEmpty(ids)) {
                duanwei.put("gameParentAttrId", 217);
                String join = StringUtils.join(ids, ",");
                duanwei.put("gameChildAttrId", join);
                goodsAttrList.add(duanwei);
            }
            ids.clear();


            //皮肤
            JSONObject pifujson = new JSONObject();
            pifujson.put("gameParentAttrId", 212);
            pifujson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF8());
            goodsAttrList.add(pifujson);
            ids.clear();

            //贵族
            JSONObject guizujson = new JSONObject();
            GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
            if (gameAttribute1.getFieldName().contains("V1") ||
                    gameAttribute1.getFieldName().contains("V2") ||
                    gameAttribute1.getFieldName().contains("V3") ||
                    gameAttribute1.getFieldName().contains("V4") ||
                    gameAttribute1.getFieldName().contains("V5") ||
                    gameAttribute1.getFieldName().contains("V6")
            ) {
                ids.add(208l);
            }

            if (gameAttribute1.getFieldName().contains("V7")) {
                ids.add(209l);
            }
            if (gameAttribute1.getFieldName().contains("V8")) {
                ids.add(210l);
            }
            if (gameAttribute1.getFieldName().contains("V9")) {
                ids.add(211l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                guizujson.put("gameParentAttrId", 207);
                String join = StringUtils.join(ids, ",");
                guizujson.put("gameChildAttrId", join);
                goodsAttrList.add(guizujson);
            }
            ids.clear();


            JSONObject skinjson = new JSONObject();
            skinjson.put("gameParentAttrId", 202);
            skinjson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF8());
            goodsAttrList.add(skinjson);
            ids.clear();


            //沉迷
            JSONObject chenmijson = new JSONObject();
            chenmijson.put("gameParentAttrId", 199);
            ids.add(201l);
            if (CollectionUtils.isNotEmpty(ids)) {
                String join = StringUtils.join(ids, ",");
                chenmijson.put("gameChildAttrId", join);
            }
            goodsAttrList.add(chenmijson);

            ids.clear();

            JSONObject shiming = new JSONObject();
            if (Arrays.asList("可二次实名").contains(gameAttribute.getFieldName())) {
                ids.add(197l);
            } else {
                ids.add(198l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 196);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();


            JSONObject wzxiyouskinjson = new JSONObject();
            String wzryxiyouskins = LSHENConstant.wzryxiyouskins;
            String pfIds = "";

            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
            List<GameAttribute> gameAttributeq = getGameAttributs(pfIds);
            jsonObjects = JSONObject.parseArray(wzryxiyouskins, JSONObject.class);
            ids = new ArrayList<>();
            for(GameAttribute gameAttribute2 : gameAttributeq) {
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute2.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiyouskinjson.put("gameParentAttrId", 142);
                String join = StringUtils.join(ids, ",");
                wzxiyouskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiyouskinjson);
            }else{
                wzxiyouskinjson.put("gameParentAttrId", 142);
                wzxiyouskinjson.put("gameChildAttrId", "143");
                goodsAttrList.add(wzxiyouskinjson);
            }
            ids.clear();

            //限定皮肤
            JSONObject wzxiandingskinjson = new JSONObject();
            String xiandingskins = LSHENConstant.xiandingskins;

            jsonObjects = JSONObject.parseArray(xiandingskins, JSONObject.class);
            ids = new ArrayList<>();
            for(GameAttribute gameAttribute2 : gameAttributeq) {
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute2.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                wzxiandingskinjson.put("gameParentAttrId", 28);
                String join = StringUtils.join(ids, ",");
                wzxiandingskinjson.put("gameChildAttrId", join);
                goodsAttrList.add(wzxiandingskinjson);
            }else{
                wzxiandingskinjson.put("gameParentAttrId", 28);
                wzxiandingskinjson.put("gameChildAttrId", 1202);
                goodsAttrList.add(wzxiandingskinjson);
            }
            ids.clear();


            //星元皮肤
            JSONObject wzxingyuanskinjson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF10())) {
                List<GameAttribute> gameAttributesss = getGameAttributs(goodsInfoAndAttrValueDto.getF10());
                String wzxingyuanskins = LSHENConstant.wzxingyuanskins;

                jsonObjects = JSONObject.parseArray(wzxingyuanskins, JSONObject.class);
                ids = new ArrayList<>();
                for (GameAttribute gameAttribute2 : gameAttributesss) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute2.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (ids.size() > 0) {
                    wzxingyuanskinjson.put("gameParentAttrId", 16);
                    String join = StringUtils.join(ids, ",");
                    wzxingyuanskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzxingyuanskinjson);
                } else{
                    wzxingyuanskinjson.put("gameParentAttrId", 16);
                    wzxingyuanskinjson.put("gameChildAttrId", 1201);
                    goodsAttrList.add(wzxingyuanskinjson);
                }
                ids.clear();
            }else {
                wzxingyuanskinjson.put("gameParentAttrId", 16);
                wzxingyuanskinjson.put("gameChildAttrId", 1201);
                goodsAttrList.add(wzxingyuanskinjson);
            }

            //典藏皮肤
            JSONObject wzdiancnagskinjson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF9())) {
                List<GameAttribute> gameAttributesss = getGameAttributs(goodsInfoAndAttrValueDto.getF9());
                String diancangskins = LSHENConstant.diancangskins;

                jsonObjects = JSONObject.parseArray(diancangskins, JSONObject.class);
                ids = new ArrayList<>();
                for (GameAttribute gameAttribute2 : gameAttributesss) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute2.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    wzdiancnagskinjson.put("gameParentAttrId", 1);
                    String join = StringUtils.join(ids, ",");
                    wzdiancnagskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzdiancnagskinjson);
                }else{
                    wzdiancnagskinjson.put("gameParentAttrId", 1);
                    wzdiancnagskinjson.put("gameChildAttrId", 1204);
                    goodsAttrList.add(wzdiancnagskinjson);
                }
                ids.clear();
            }else {
                wzdiancnagskinjson.put("gameParentAttrId", 1);
                wzdiancnagskinjson.put("gameChildAttrId", 1204);
                goodsAttrList.add(wzdiancnagskinjson);
            }

        }
        if (Objects.equals("枪战王者", goodsInfoAndAttrValueDto.getGameName())) {
            params.put("gameId", "73");
            if(goodsInfoAndAttrValueDto.getSystemName().contains("安卓")) {
                params.put("systemId", "76");
            }else{
                params.put("systemId", "77");
            }
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if (Objects.equals("安卓QQ",regional)) {
                params.put("gameSysId", "76");
                params.put("gameServerId", "84");
            } else if (Objects.equals("安卓微信", regional)) {
                params.put("gameSysId", "76");
                params.put("gameServerId", "85");
            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "77");
                params.put("gameServerId", "83");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "77");
                params.put("gameServerId", "82");
            }
            String wzryxiyou = LSHENConstant.lsqzwz;
            JSONArray jsonArray = JSONArray.parseArray(wzryxiyou);
            for(Object o: jsonArray){
                if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                    JSONObject gzdj = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                    if (JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("贵族等级")) {
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for (Object p : jsonArray1) {
                            if(gameAttribute1.getFieldName().equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        gzdj.put("gameParentAttrId", 865);
                        String join = StringUtils.join(ids, ",");
                        gzdj.put("gameChildAttrId", join);
                        goodsAttrList.add(gzdj);
                    }
                    ids.clear();
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    JSONObject fcm = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    ids.add(864l);
                    fcm.put("gameParentAttrId", 862);
                    String join = StringUtils.join(ids, ",");
                    fcm.put("gameChildAttrId", join);
                    goodsAttrList.add(fcm);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("二次实名")){
                    JSONObject fcm = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    if(gameAttribute.getFieldName().contains("有修改人脸机会")) {
                        ids.add(860l);
                    }else{
                        ids.add(861l);
                    }
                    fcm.put("gameParentAttrId", 859);
                    String join = StringUtils.join(ids, ",");
                    fcm.put("gameChildAttrId", join);
                    goodsAttrList.add(fcm);
                }
            }

        }
        if (Objects.equals("和平精英", goodsInfoAndAttrValueDto.getGameName())) {


            params.put("gameId", "68");
            if(goodsInfoAndAttrValueDto.getSystemName().contains("安卓")) {
                params.put("systemId", "67");
            }else{
                params.put("systemId", "68");
            }
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if (Objects.equals("安卓QQ",regional)) {
                params.put("gameSysId", "67");
                params.put("gameServerId", "59");
            } else if (Objects.equals("安卓微信", regional)) {
                params.put("gameSysId", "67");
                params.put("gameServerId", "60");
            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "68");
                params.put("gameServerId", "57");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "68");
                params.put("gameServerId", "58");
            }

            String wzryxiyou = LSHENConstant.xiyoutaozhuang;
            List<JSONObject> jsonObjects = JSONObject.parseArray(wzryxiyou, JSONObject.class);
            List<Long> ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                JSONObject xiyouwz = new JSONObject();
                List<GameAttribute> gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                for (GameAttribute gameAttribute1 : gameAttributes) {
                    String fieldName = gameAttribute1.getFieldName();
                    if (fieldName.contains("雪国幻梦")) {
                        fieldName = "雪国梦幻";
                    }
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (subAttrName.contains("初号初款机体服")) {
                            subAttrName = "初号机款机体服";
                        }
                        if (fieldName.contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    xiyouwz.put("gameParentAttrId", 389);
                    String join = StringUtils.join(ids, ",");
                    xiyouwz.put("gameChildAttrId", join);
                    goodsAttrList.add(xiyouwz);
                }
                ids.clear();
            }

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF15())) {
                JSONObject duanwei = new JSONObject();
                String duanweiStr = LSHENConstant.hpduanwei;
                GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF15()));
                jsonObjects = JSONObject.parseArray(duanweiStr, JSONObject.class);
                ids = new ArrayList<>();
                for (JSONObject jsonObject : jsonObjects) {
                    String subAttrName = jsonObject.getString("subAttrName");
                    if (gameAttribute1.getFieldName().contains(subAttrName)) {
                        Long id = jsonObject.getLong("id");
                        ids.add(id);
                        break;
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    duanwei.put("gameParentAttrId", 267);
                    String join = StringUtils.join(ids, ",");
                    duanwei.put("gameChildAttrId", join);
                    goodsAttrList.add(duanwei);
                }
                ids.clear();
            }

            //皮肤
            JSONObject pifujson = new JSONObject();
//            if (accountInfo.getGuns() > -1 && accountInfo.getGuns() <= 5) {
//                ids.add(261l);
//            }
//            if (accountInfo.getGuns() > 6 && accountInfo.getGuns() <= 10) {
//                ids.add(262l);
//            }
//            if (accountInfo.getGuns() > 11 && accountInfo.getGuns() <= 20) {
//                ids.add(263l);
//            }
//            if (accountInfo.getGuns() > 21 && accountInfo.getGuns() <= 30) {
//                ids.add(264l);
//            }
//            if (accountInfo.getGuns() > 31 && accountInfo.getGuns() <= 45) {
//                ids.add(265l);
//            }
//            if (accountInfo.getGuns() > 45 && accountInfo.getGuns() <= 9999999) {
//                ids.add(266l);
//            }
            pifujson.put("gameParentAttrId", 260);
//            String join = StringUtils.join(ids, ",");
            pifujson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF8());
            goodsAttrList.add(pifujson);
            ids.clear();

//            GameAttribute gameAttribute2 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF15()));
//            JSONObject guizujson = new JSONObject();
//            if (gameAttribute2.getFieldName().contains("V1") ||
//                    gameAttribute2.getFieldName().contains("V2") ||
//                    gameAttribute2.getFieldName().contains("V3") ||
//                    gameAttribute2.getFieldName().contains("V4") ||
//                    gameAttribute2.getFieldName().contains("V5") ||
//                    gameAttribute2.getFieldName().contains("V6")
//            ) {
//                ids.add(208l);
//            }
//
//            if (gameAttribute2.getFieldName().contains("V7")) {
//                ids.add(209l);
//            }
//            if (gameAttribute2.getFieldName().contains("V8")) {
//                ids.add(210l);
//            }
//            if (gameAttribute2.getFieldName().contains("V9")) {
//                ids.add(211l);
//            }
//            if (CollectionUtils.isNotEmpty(ids)) {
//                String join = StringUtils.join(ids, ",");
//                guizujson.put("gameChildAttrId", join);
//                guizujson.put("gameParentAttrId", 207);
//                goodsAttrList.add(guizujson);
//            }
//            ids.clear();


            JSONObject skinjson = new JSONObject();
//            if (accountInfo.getSuit() > -1 && accountInfo.getSuit() <= 50) {
//                ids.add(245l);
//            }
//            if (accountInfo.getSuit() > 51 && accountInfo.getSuit() <= 100) {
//                ids.add(246l);
//            }
//            if (accountInfo.getSuit() > 101 && accountInfo.getSuit() <= 150) {
//                ids.add(247l);
//            }
//            if (accountInfo.getSuit() > 151 && accountInfo.getSuit() <= 250) {
//                ids.add(248l);
//            }
//            if (accountInfo.getSuit() > 251 && accountInfo.getSuit() <= 351) {
//                ids.add(249l);
//            }
//            if (accountInfo.getSuit() > 351 && accountInfo.getSuit() <= 450) {
//                ids.add(250l);
//            }
//            if (accountInfo.getSuit() > 450 && accountInfo.getSuit() <= 99999999) {
//                ids.add(251l);
//            }
            skinjson.put("gameParentAttrId", 244);
            skinjson.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF8());
            goodsAttrList.add(skinjson);

            ids.clear();

            //沉迷
            JSONObject chenmijson = new JSONObject();
            ids.add(243l);
            if (CollectionUtils.isNotEmpty(ids)) {
                chenmijson.put("gameParentAttrId", 241);
                String join = StringUtils.join(ids, ",");
                chenmijson.put("gameChildAttrId", join);
                goodsAttrList.add(chenmijson);
            }
            ids.clear();

            JSONObject shiming = new JSONObject();
            if (Arrays.asList("可二次实名").contains(gameAttribute.getFieldName())) {
                ids.add(239l);
            } else {
                ids.add(240l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 238);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();

            JSONObject wzxiyouskinjson = new JSONObject();
            String wzryxiyouskins = LSHENConstant.remenqix;
            jsonObjects = JSONObject.parseArray(wzryxiyouskins, JSONObject.class);
            ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF1())) {
                List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF1());
                for (GameAttribute gameAttribute3 : gameAttributeList) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute3.getFieldName().replace("-", "").contains(subAttrName.replace("-", ""))) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    wzxiyouskinjson.put("gameParentAttrId", 334);
                    String join = StringUtils.join(ids, ",");
                    wzxiyouskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzxiyouskinjson);
                }
                ids.clear();
            }

            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                //限定皮肤
                JSONObject wzxiandingskinjson = new JSONObject();
                String wzryxiandingskins = LSHENConstant.remzju;
                List<GameAttribute> gameAttributeLists = getGameAttributs(goodsInfoAndAttrValueDto.getF2());
                jsonObjects = JSONObject.parseArray(wzryxiandingskins, JSONObject.class);
                ids = new ArrayList<>();
                for (GameAttribute gameAttribute3 : gameAttributeLists) {
                    String fieldName = gameAttribute3.getFieldName();
                    if (fieldName.contains("特斯拉R水滴蓝")) {
                        fieldName = "特斯拉水滴蓝";
                    } else if (fieldName.contains("兰博SVJ绿色")) {
                        fieldName = "兰博基尼SVJ(绿)";
                    } else if (fieldName.contains("特斯拉R尊享铂")) {
                        fieldName = "特斯拉尊贵铂";
                    } else if (fieldName.contains("特斯拉R沁心粉")) {
                        fieldName = "特斯拉沁心粉";
                    } else if (fieldName.contains("兰博轿车灰色")) {
                        fieldName = "兰博基尼Est( 灰)";
                    } else if (fieldName.contains("兰博轿车金色")) {
                        fieldName = "兰博基尼Est(金)";
                    } else if (fieldName.contains("特斯拉C荒芜蓝")) {
                        fieldName = "特斯拉荒芜蓝";
                    } else if (fieldName.contains("特斯拉X白色")) {
                        fieldName = "Model X白";
                    } else if (fieldName.contains("兰博SUV黄色")) {
                        fieldName = "兰博基尼SUV(黄)";
                    } else if (fieldName.contains("特斯拉C极昼黑")) {
                        fieldName = "特斯拉极昼黑";
                    } else if (fieldName.contains("特斯拉C镭光铂")) {
                        fieldName = "特斯拉镭光铂";
                    } else if (fieldName.contains("兰博SUV金色")) {
                        fieldName = "兰博基尼SUV(金)";
                    } else if (fieldName.contains("特斯拉3白色")) {
                        fieldName = "Model 3白";
                    } else if (fieldName.contains("兰博SVJ尊享铂")) {
                        fieldName = "兰博基尼SVJ(铂)";
                    } else if (fieldName.contains("兰博轿车尊享铂")) {
                        fieldName = "兰博基尼Est(铂)";
                    } else if (fieldName.contains("特斯拉X银色")) {
                        fieldName = "Model X银";
                    } else if (fieldName.contains("特斯拉X紫色")) {
                        fieldName = "Model X紫";
                    } else if (fieldName.contains("特斯拉3银色")) {
                        fieldName = "Model 3银";
                    } else if (fieldName.contains("兰博SUV尊享铂")) {
                        fieldName = "兰博基尼SUV(铂)";
                    } else if (fieldName.contains("特斯拉3紫色")) {
                        fieldName = "Model 3紫";
                    } else if (fieldName.contains("路特斯EV紫色")) {
                        fieldName = "路特斯EVIJA（电光紫）";
                    } else if (fieldName.contains("路特斯EL紫色")) {
                        fieldName = "路特斯ELETRE(电光紫）";
                    } else if (fieldName.contains("路特斯EL蓝色")) {
                        fieldName = "路特斯ELETRE(冰川蓝）";
                    } else if (fieldName.contains("路特斯EV黄色")) {
                        fieldName = "路特斯EVIJA（星际黄）";
                    } else if (fieldName.contains("塞莎鲸之蓝")) {
                        fieldName = "快艇塞拉鲸之蓝";
                    } else if (fieldName.contains("塞莎霓虹粉")) {
                        fieldName = "快艇塞拉霓虹粉";
                    } else if (fieldName.contains("塞莎深潜蓝")) {
                        fieldName = "快艇塞拉深潜蓝";
                    }
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (subAttrName.contains("双刃魅影")) {
                            subAttrName = subAttrName.replace("(", "").replace(")", "");
                        }
                        if (fieldName.replace("-", "").contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
                if (CollectionUtils.isNotEmpty(ids)) {
                    wzxiandingskinjson.put("gameParentAttrId", 276);
                    String join = StringUtils.join(ids, ",");
                    wzxiandingskinjson.put("gameChildAttrId", join);
                    goodsAttrList.add(wzxiandingskinjson);
                }
            }
        }
        if (Objects.equals("原神", goodsInfoAndAttrValueDto.getGameName())) {

//            params.put("goodsTitle", gameName);

            params.put("gameId", "69");

            params.put("gameSysId", "70");
            if (goodsInfoAndAttrValueDto.getCarrierName().contains("游戏官方")) {
                params.put("gameServerId", "65");
            }
            if (goodsInfoAndAttrValueDto.getCarrierName().contains("哔哩哔哩")) {
                params.put("gameServerId", "66");
            }
//            params.put("gameName", goodsInfoAndAttrValueDto.getGameName());

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            String ys5xing = LSHENConstant.ys5xing;
            List<JSONObject> jsonObjects = JSONObject.parseArray(ys5xing, JSONObject.class);
            List<Long> ids = new ArrayList<>();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                List<GameAttribute> jsList = getGameAttributs(goodsInfoAndAttrValueDto.getF11());
                for (GameAttribute gameAttribute1 : jsList) {
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 543);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();

            //皮肤
            JSONObject pifujson = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF17())) {
                String[] wqs = goodsInfoAndAttrValueDto.getF17().split(",");
                if (wqs.length > -1 && wqs.length <= 5) {
                    ids.add(538l);
                }
                if (wqs.length >= 6 && wqs.length <= 10) {
                    ids.add(539l);
                }
                if (wqs.length >= 11 && wqs.length <= 20) {
                    ids.add(540l);
                }
                if (wqs.length >= 21 && wqs.length <= 30) {
                    ids.add(541l);
                }
                if (wqs.length >= 31 && wqs.length <= 9999999) {
                    ids.add(542l);
                }
            }else{
                ids.add(538l);
            }
            pifujson.put("gameParentAttrId", 537);
            if(ids.size()>0) {
                pifujson.put("gameChildAttrValue", ids.get(0));
            }else{
                pifujson.put("gameChildAttrValue", 538l);
            }
            ids.clear();
            //5星角色数量
            JSONObject juese = new JSONObject();
            if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF11())) {
                String[] jss = goodsInfoAndAttrValueDto.getF11().split(",");
                if (jss.length > -1 && jss.length <= 5) {
                    ids.add(532l);
                }
                if (jss.length >= 6 && jss.length <= 10) {
                    ids.add(533l);
                }
                if (jss.length >= 11 && jss.length <= 15) {
                    ids.add(534l);
                }
                if (jss.length >= 15 && jss.length <= 25) {
                    ids.add(535l);
                }
                if (jss.length >= 25 && jss.length <= 9999999) {
                    ids.add(536l);
                }
            }else{
                ids.add(532l);
            }
            juese.put("gameParentAttrId", 531);
            juese.put("gameChildAttrValue", ids.get(0));
            goodsAttrList.add(juese);
            ids.clear();

            gameAttribute=gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF20()));
            JSONObject shiming = new JSONObject();
            if (!Objects.equals("可修改邮箱", gameAttribute.getFieldName())) {
                ids.add(526l);
            } else {
                ids.add(525l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 524);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }

            ids.clear();
        }
        if (Objects.equals("英雄联盟", goodsInfoAndAttrValueDto.getGameName())) {
//            params.put("goodsTitle",goodsInfoAndAttrValueDto.getDes());

            params.put("gameId", "71");
            params.put("gameSysId", "71");

            String lccLOLr = LSHENConstant.lolr;
            JSONObject lOLrObject = JSONObject.parseObject(lccLOLr);
            String lOLrObjectArr = lOLrObject.getString("retData");
            List<JSONObject> rList = JSONObject.parseArray(lOLrObjectArr, JSONObject.class);
            for (JSONObject jsonObject : rList) {
                String gameServerVoList = jsonObject.getString("gameServerVoList");
                List<JSONObject> serverVoListJson = JSONObject.parseArray(gameServerVoList, JSONObject.class);
                for (JSONObject areaJson : serverVoListJson) {

                    String serverId = areaJson.getString("serverId");

                    String gameAreaVoList = areaJson.getString("gameAreaVoList");
                    List<JSONObject> areaJsonList = JSONObject.parseArray(gameAreaVoList, JSONObject.class);
                    for (JSONObject gameArea : areaJsonList) {
                        String areaName = gameArea.getString("areaName");
                        if (Objects.equals(goodsInfoAndAttrValueDto.getServerName(), areaName)) {
                            params.put("gameServerId", serverId);
                            params.put("gameAreaId", gameArea.getString("areaId"));
                        }
                    }
                }
            }
            String pfIds = "";
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF7());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF8());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF9());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF10());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF11());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF12());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF13());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF14());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF15());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF16());
            pfIds = reIds(pfIds, goodsInfoAndAttrValueDto.getF17());
            List<GameAttribute> gameAttributes = getGameAttributs(pfIds);
            String lsyxlm = LSHENConstant.lsyxlm;
            JSONArray jsonArray = JSONArray.parseArray(lsyxlm);
            for(Object o : jsonArray){
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("海克斯皮肤")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 688);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("至臻皮肤")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 661);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("稀有皮肤")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    String subAttrSettingVoList =  JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                    JSONArray jsonArray1 =  JSONArray.parseArray(subAttrSettingVoList);
                    for(GameAttribute gameAttribute1 : gameAttributes){
                        for(Object p : jsonArray1){
                            if(gameAttribute1.getFieldName().replace("/","").equals(JSONObject.parseObject(p.toString()).getString("subAttrName"))){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                    }
                    if (CollectionUtils.isNotEmpty(ids)) {
                        xiyouwz.put("gameParentAttrId", 653);
                        String join = StringUtils.join(ids, ",");
                        xiyouwz.put("gameChildAttrId", join);
                        goodsAttrList.add(xiyouwz);
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("炫彩皮肤数量")){
                    JSONObject xiyouwz = new JSONObject();
//                    List<Long> ids = new ArrayList<>();
                    xiyouwz.put("gameParentAttrId", 647);
                    xiyouwz.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF5()==null||goodsInfoAndAttrValueDto.getF5().equals("")?0:goodsInfoAndAttrValueDto.getF5());
                    goodsAttrList.add(xiyouwz);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("单双排段位")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF2())) {
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF2()));
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(Object p : jsonArray1){
                            if(JSONObject.parseObject(p.toString()).getString("subAttrName").equals(gameAttribute1.getFieldName())){
                                ids.add(JSONObject.parseObject(p.toString()).getLong("id"));
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            xiyouwz.put("gameParentAttrId", 637);
                            String join = StringUtils.join(ids, ",");
                            xiyouwz.put("gameChildAttrId", join);
                            goodsAttrList.add(xiyouwz);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
                    ids.add(636l);
                    String join = StringUtils.join(ids, ",");
                    xiyouwz.put("gameParentAttrId", 634);
                    xiyouwz.put("gameChildAttrId", join);
                    goodsAttrList.add(xiyouwz);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("英雄数量")){
                    JSONObject xiyouwz = new JSONObject();
                    List<Long> ids = new ArrayList<>();
//                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF3())){
//                        if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=1&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=30){
//                            ids.add(629l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=31&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=60){
//                            ids.add(630l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=61&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=100){
//                            ids.add(631l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=101&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=150){
//                            ids.add(632l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF3())>=150&&Integer.parseInt(goodsInfoAndAttrValueDto.getF3())<=9999999){
//                            ids.add(633l);
//                        }
//                    }else{
//                        ids.add(629l);
//                    }
//                    String join = StringUtils.join(ids, ",");
//                    xiyouwz.put("gameParentAttrId", 628);
//                    xiyouwz.put("gameChildAttrId", join);
                    xiyouwz.put("gameParentAttrId", 628);
                    xiyouwz.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF3()==null||goodsInfoAndAttrValueDto.getF3().equals("")?0:goodsInfoAndAttrValueDto.getF3());
                    goodsAttrList.add(xiyouwz);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("皮肤数量")){
                    JSONObject xiyouwz = new JSONObject();
//                    List<Long> ids = new ArrayList<>();
//                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF4())){
//                        if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=1&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=100){
//                            ids.add(622l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=101&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=300){
//                            ids.add(623l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=301&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=500){
//                            ids.add(624l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=501&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=800){
//                            ids.add(625l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=801&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=1200){
//                            ids.add(626l);
//                        }else if(Integer.parseInt(goodsInfoAndAttrValueDto.getF4())>=1201&&Integer.parseInt(goodsInfoAndAttrValueDto.getF4())<=9999999){
//                            ids.add(627l);
//                        }
//                    }else {
//                        ids.add(622l);
//                    }
//                    String join = StringUtils.join(ids, ",");
//                    xiyouwz.put("gameParentAttrId", 621);
//                    xiyouwz.put("gameChildAttrId", join);
                    xiyouwz.put("gameParentAttrId", 621);
                    xiyouwz.put("gameChildAttrValue", goodsInfoAndAttrValueDto.getF4()==null||goodsInfoAndAttrValueDto.getF4().equals("")?0:goodsInfoAndAttrValueDto.getF4());
                    goodsAttrList.add(xiyouwz);
                }
            }
        }
        if (Objects.equals("穿越火线", goodsInfoAndAttrValueDto.getGameName())) {

            params.put("gameId", "72");

            params.put("gameSysId", "69");
            if (Objects.equals("东部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "61");
            }
            if (Objects.equals("南部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "62");
            }
            if (Objects.equals("西部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "63");
            }
            if (Objects.equals("北部战区", goodsInfoAndAttrValueDto.getGroupName())) {
                params.put("gameServerId", "64");
            }

//            gameParentAttrId
            JSONObject xiyouwz = new JSONObject();

            String ys5xing = LSHENConstant.cfvq;
            List<GameAttribute> gameAttributes = getGameAttributs(goodsInfoAndAttrValueDto.getF13());
            List<Long> ids = new ArrayList<>();
            String fieldName = "";
            if(CollectionUtils.isNotEmpty(gameAttributes)) {
                for (GameAttribute gameAttribute1 : gameAttributes) {
                    List<JSONObject> jsonObjects = JSONObject.parseArray(ys5xing, JSONObject.class);
                    for (JSONObject jsonObject : jsonObjects) {
                        String subAttrName = jsonObject.getString("subAttrName");
                        if (gameAttribute1.getFieldName().contains("Scar Light-白虎")) {
                            fieldName = "Scar-白虎";
                        }
                        if (fieldName.contains(subAttrName)) {
                            Long id = jsonObject.getLong("id");
                            ids.add(id);
                        }
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                xiyouwz.put("gameParentAttrId", 467);
                String join = StringUtils.join(ids, ",");
                xiyouwz.put("gameChildAttrId", join);
                goodsAttrList.add(xiyouwz);
            }
            ids.clear();

            JSONObject chenmi = new JSONObject();
            chenmi.put("gameParentAttrId", 443);
            chenmi.put("gameChildAttrId", 445);
            goodsAttrList.add(chenmi);

            ids.clear();
            JSONObject shiming = new JSONObject();
            if (gameAttribute.getFieldName().contains("有修改机会且实名")) {
                ids.add(441l);
            } else {
                ids.add(442l);
            }
            if (CollectionUtils.isNotEmpty(ids)) {
                shiming.put("gameParentAttrId", 440);
                String join = StringUtils.join(ids, ",");
                shiming.put("gameChildAttrId", join);
                goodsAttrList.add(shiming);
            }
            ids.clear();
        }
        if (Objects.equals("地下城与勇士", goodsInfoAndAttrValueDto.getGameName())) {

            params.put("gameId", "70");
            JSONObject gameServices = getGameServices("70");
            JSONArray jsonArray = gameServices.getJSONArray("retData");
            List<JSONObject> list = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(jsonArray)) {
                for (Object o : jsonArray) {
                    JSONObject object = JSONObject.parseObject(o.toString());
                    JSONArray list1 = object.getJSONArray("gameServerVoList");
                    if (CollectionUtils.isNotEmpty(list1)) {
                        for (Object o1 : list1) {
                            JSONObject jsonObject = JSONObject.parseObject(o1.toString());
                            jsonObject.put("systemName", object.getString("systemName"));
                            jsonObject.put("systemId", object.getString("systemId"));
                            list.add(jsonObject);
                        }
                    }
                }
                Map<String, JSONObject> name = list.stream().collect(Collectors.toMap(s -> s.getString("serverName"), s -> s));
                GameAttribute attribute = gameAttributeMapper.selectGameAttributeById(goodsInfoAndAttrValueDto.getServerId());
                if (!Objects.isNull(name.get(attribute.getFieldName()))){
                    JSONObject object = name.get(attribute.getFieldName());
                    params.put("gameServerId", object.getString("serverId"));
                    params.put("gameSysId", object.getString("systemId"));
                }
            }
            JSONObject chenmi = new JSONObject();
            chenmi.put("gameParentAttrId", 618);
            chenmi.put("gameChildAttrId", 619);
            goodsAttrList.add(chenmi);
            JSONObject chifa = new JSONObject();
            chifa.put("gameParentAttrId", 615);
            chifa.put("gameChildAttrId", 617);
            goodsAttrList.add(chifa);
            JSONObject xinyong = new JSONObject();
            xinyong.put("gameParentAttrId", 612);
            xinyong.put("gameChildAttrId", 614);
            goodsAttrList.add(xinyong);
        }
        if (Objects.equals("火影忍者", goodsInfoAndAttrValueDto.getGameName())) {
            params.put("gameId", "74");
            String regional = goodsInfoAndAttrValueDto.getSystemName()+goodsInfoAndAttrValueDto.getCarrierName();
            if (Objects.equals("安卓QQ", regional)) {
                params.put("gameSysId", "73");
                params.put("gameServerId", "78");
            } else if (Objects.equals("安卓微信", regional)) {
                params.put("gameSysId", "73");
                params.put("gameServerId", "79");
            } else if (Objects.equals("苹果微信", regional)) {
                params.put("gameSysId", "74");
                params.put("gameServerId", "77");
            } else if (Objects.equals("苹果QQ", regional)) {
                params.put("gameSysId", "74");
                params.put("gameServerId", "76");
            }
            String retData = JSONObject.parseObject(LSHENConstant.hyrz).getString("retData");
            JSONArray jsonArray = JSONArray.parseArray(retData);
            for(Object o : jsonArray){
                JSONObject jsonObject = new JSONObject();
                List<Long> ids = new ArrayList<>();
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("A忍")){
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF6())) {
                        List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF6());
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(GameAttribute gameAttribute1 : gameAttributeList){
                            for(Object p : jsonArray1){
                                if(JSONObject.parseObject(p.toString()).getString("subAttrName").contains(gameAttribute1.getFieldName())){
                                    Long id = jsonObject.getLong("id");
                                    ids.add(id);
                                }
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                            String join = StringUtils.join(ids, ",");
                            jsonObject.put("gameChildAttrId", join);
                            goodsAttrList.add(jsonObject);
                            JSONObject ashuliang = new JSONObject();
                            ashuliang.put("gameParentAttrId",745);
                            if(ids.size()>=1&&ids.size()<=10) {
                                ashuliang.put("gameChildAttrId", 746);
                            }else if(ids.size()>=11&&ids.size()<=20) {
                                ashuliang.put("gameChildAttrId", 747);
                            }else if(ids.size()>=21&&ids.size()<=40) {
                                ashuliang.put("gameChildAttrId", 748);
                            }else if(ids.size()>=41&&ids.size()<=60) {
                                ashuliang.put("gameChildAttrId", 749);
                            }else if(ids.size()>60) {
                                ashuliang.put("gameChildAttrId", 750);
                            }
                            goodsAttrList.add(ashuliang);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("S忍")){
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF5())) {
                        List<GameAttribute> gameAttributeList = getGameAttributs(goodsInfoAndAttrValueDto.getF5());
                        String subAttrSettingVoList = JSONObject.parseObject(o.toString()).getString("subAttrSettingVoList");
                        JSONArray jsonArray1 = JSONArray.parseArray(subAttrSettingVoList);
                        for(GameAttribute gameAttribute1 : gameAttributeList){
                            for(Object p : jsonArray1){
                                if(JSONObject.parseObject(p.toString()).getString("subAttrName").contains(gameAttribute1.getFieldName())){
                                    Long id = jsonObject.getLong("id");
                                    ids.add(id);
                                }
                            }
                        }
                        if (CollectionUtils.isNotEmpty(ids)) {
                            jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                            String join = StringUtils.join(ids, ",");
                            jsonObject.put("gameChildAttrId", join);
                            goodsAttrList.add(jsonObject);
                            JSONObject ashuliang = new JSONObject();
                            ashuliang.put("gameParentAttrId",739);
                            if(ids.size()>=1&&ids.size()<=5) {
                                ashuliang.put("gameChildAttrId", 740);
                            }else if(ids.size()>=6&&ids.size()<=10) {
                                ashuliang.put("gameChildAttrId", 741);
                            }else if(ids.size()>=11&&ids.size()<=20) {
                                ashuliang.put("gameChildAttrId", 742);
                            }else if(ids.size()>=21&&ids.size()<=30) {
                                ashuliang.put("gameChildAttrId", 743);
                            }else if(ids.size()>30) {
                                ashuliang.put("gameChildAttrId", 744);
                            }
                            goodsAttrList.add(ashuliang);
                        }
                    }
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("有无防沉迷")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    jsonObject.put("gameChildAttrId", 730);
                    goodsAttrList.add(jsonObject);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("二次实名")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF7())){
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF7()));
                        if(gameAttribute1.getFieldName().equals("可改二次")){
                            jsonObject.put("gameChildAttrId", 726);
                        }else{
                            jsonObject.put("gameChildAttrId", 727);
                        }
                    }else{
                        jsonObject.put("gameChildAttrId", 727);
                    }
                    goodsAttrList.add(jsonObject);
                }
                if(JSONObject.parseObject(o.toString()).getString("parentAttrName").equals("VIP等级")){
                    jsonObject.put("gameParentAttrId", JSONObject.parseObject(o.toString()).getString("id"));
                    if(StringUtils.isNotEmpty(goodsInfoAndAttrValueDto.getF8())){
                        GameAttribute gameAttribute1 = gameAttributeMapper.selectGameAttributeById(Long.valueOf(goodsInfoAndAttrValueDto.getF8()));
                        if("V1,V2,V3".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 718);
                        }else if("V4,V5,V6".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 719);
                        }else if("V7,V8,V9".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 720);
                        }else if("V10,V11,V12".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 721);
                        }else if("V13".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 722);
                        }else if("V14".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 723);
                        }else if("V15".contains(gameAttribute1.getFieldName())){
                            jsonObject.put("gameChildAttrId", 724);
                        }
                    }else{
                        jsonObject.put("gameChildAttrId", 718);
                    }
                    goodsAttrList.add(jsonObject);
                }
            }
        }

        params.put("goodsAttrList", goodsAttrList);
        params.put("compensation", "1");
        params.put("channelProductCode", goodsInfoAndAttrValueDto.getId());
        if("王者荣耀".equals(goodsInfoAndAttrValueDto.getGameName())) {
            if (StringUtils.isEmpty(goodsInfoAndAttrValueDto.getF17())) {
                throw new GlobalException("营地ID不能为空");
            }
            params.put("campNo", goodsInfoAndAttrValueDto.getF17());
        }
        params.put("goodsType", "0");
        params.put("qty", "1");


//        String appKey = "yuduwangluo";
//        String appSecret = "kbcyRN68obBkdwXIbwZ7eRks14tM1AsI";
        String appKey = salePartner.getSaleKey();
        String appSecret = salePartner.getOther();
        String version = "1.0";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        Map<String, Object> paramReq = new HashMap<>();
        paramReq.put("appKey", appKey);
        paramReq.put("timestamp", timestamp);
        paramReq.put("version", version);
        paramReq.put("paramJson", JSONObject.toJSONString(params));
        log.info("paramJson={}", JSONObject.toJSONString(params));
        System.out.println(JSONObject.toJSONString(params));
        String sign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(params));
//        params.put("sign", sign);
        paramReq.put("sign", sign);
        return paramReq;
    }
    private List<GameAttribute> getGameAttributs(String ids) {
        List<GameAttribute> list = new ArrayList<>();
        if (StringUtils.isNotEmpty(ids)) {
            list = gameAttributeMapper.selectGameAttributeListByIds((Long[]) ConvertUtils.convert(ids.split(","),
                    Long.class));
        }
        return list;
    }
    private String reIds(String allIds, String ids) {
        if (StringUtils.isNotEmpty(ids)) {
            if (StringUtils.isNotEmpty(allIds)) {
                allIds = allIds + "," + ids;
            } else {
                allIds = ids;
            }
        }
        return allIds;
    }

    public AjaxResult up(String goodsNo, SalePartner sa) {

        String path = "/apiProduct/up";
        Map<String, Object> paramsup = new HashMap<>();
        List<Map<String, Object>> goodsList = new ArrayList<>();
        paramsup.put("goodsNo", goodsNo);
        goodsList.add(paramsup);
        Map<String, Object> map = new HashMap<>();
        map.put("goodsList", goodsList);
        String appKey = sa.getSaleKey();
        String appSecret = sa.getOther();
        String version = "1.0";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        Map<String, Object> paramReq = new HashMap<>();
        paramReq.put("appKey", appKey);
        paramReq.put("timestamp", timestamp);
        paramReq.put("version", version);
        paramReq.put("paramJson", JSONObject.toJSONString(map));
        log.info("paramJson={}", JSONObject.toJSONString(map));

        String sign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(map));
//        params.put("sign", sign);
        paramReq.put("sign", sign);

        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);

        log.info("雷神上架接口请求参数={}", JSONObject.toJSONString(paramReq));
        String response = HttpUtils.doPostForm(sa.getTwoOther() + path, paramReq, header);
        if (StringUtils.isEmpty(response)) {
            throw new GlobalException("请求接口失败");
        }
        log.info("雷神上架接口返回参数={}", JSONObject.toJSONString(response));
        JSONObject resultJson = JSONObject.parseObject(response);
        Map<String, Object> result = new HashMap<>();

        if (!"true".equals(resultJson.getString("success"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }

        result.put("req", JSONObject.toJSONString(paramReq));
        result.put("res", response);
        result.put("msg", resultJson.getString("data"));
        return AjaxResult.success(result);
    }

    @Override
    public AjaxResult delGame(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner sa) {

        String path = "/apiProduct/down";

        List<Map<String, Object>> goodsList = new ArrayList<>();
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        Map<String, Object> paramsDel = new HashMap<>();
        if(CollectionUtils.isEmpty(artRecs)){
            throw new GlobalException("当前账号未推送，不可删除");
        }
        paramsDel.put("goodsNo", artRecs.get(0).getOutid());
        goodsList.add(paramsDel);
        Map<String, Object> map = new HashMap<>();
        map.put("goodsList", goodsList);
//        String appKey = "yuduwangluo";
//        String appSecret = "kbcyRN68obBkdwXIbwZ7eRks14tM1AsI";

        String appKey = sa.getSaleKey();
        String appSecret = sa.getOther();
        String version = "1.0";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        Map<String, Object> paramReq = new HashMap<>();
        paramReq.put("appKey", appKey);
        paramReq.put("timestamp", timestamp);
        paramReq.put("version", version);
        paramReq.put("paramJson", JSONObject.toJSONString(map));
        log.info("paramJson={}", JSONObject.toJSONString(map));

        String sign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(map));
//        params.put("sign", sign);
        paramReq.put("sign", sign);

        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);

        log.info("雷神删除接口请求参数={}", JSONObject.toJSONString(paramReq));
        String response = HttpUtils.doPostForm(sa.getTwoOther() + path, paramReq, header);
        if (StringUtils.isEmpty(response)) {
            throw new GlobalException("请求接口失败");
        }
        log.info("雷神删除接口返回参数={}", JSONObject.toJSONString(response));
        JSONObject resultJson = JSONObject.parseObject(response);
        Map<String, Object> result = new HashMap<>();

        ArtRec artRecreq1 = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs1 = artRecMapper.selectArtRecList(artRecreq1);
        artRecMapper.deleteArtRecById(artRecs1.get(0).getId());
        if (!"true".equals(resultJson.getString("success"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
            //下架后删除
            delete(goodsInfoAndAttrValueDto,sa);
        }

        result.put("req", JSONObject.toJSONString(paramReq));
        result.put("res", response);
        result.put("msg", resultJson.getString("data"));
        return AjaxResult.success(result);
    }

    //删除
    public AjaxResult delete(GoodsInfoAndAttrValueDto goodsInfoAndAttrValueDto, SalePartner sa) {
        String path = "/apiProduct/del";

        List<Map<String, Object>> goodsList = new ArrayList<>();
        ArtRec artRecreq = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs = artRecMapper.selectArtRecList(artRecreq);
        Map<String, Object> paramsDel = new HashMap<>();
        if(CollectionUtils.isEmpty(artRecs)){
            throw new GlobalException("当前账号未推送，不可删除");
        }
        paramsDel.put("goodsNo", artRecs.get(0).getOutid());
        goodsList.add(paramsDel);
        Map<String, Object> map = new HashMap<>();
        map.put("goodsList", goodsList);
//        String appKey = "yuduwangluo";
//        String appSecret = "kbcyRN68obBkdwXIbwZ7eRks14tM1AsI";

        String appKey = sa.getSaleKey();
        String appSecret = sa.getOther();
        String version = "1.0";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        Map<String, Object> paramReq = new HashMap<>();
        paramReq.put("appKey", appKey);
        paramReq.put("timestamp", timestamp);
        paramReq.put("version", version);
        paramReq.put("paramJson", JSONObject.toJSONString(map));
        log.info("paramJson={}", JSONObject.toJSONString(map));

        String sign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(map));
//        params.put("sign", sign);
        paramReq.put("sign", sign);

        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);

        log.info("雷神删除接口请求参数={}", JSONObject.toJSONString(paramReq));
        String response = HttpUtils.doPostForm(sa.getTwoOther() + path, paramReq, header);
        if (StringUtils.isEmpty(response)) {
            throw new GlobalException("请求接口失败");
        }
        log.info("雷神删除接口返回参数={}", JSONObject.toJSONString(response));
        JSONObject resultJson = JSONObject.parseObject(response);
        Map<String, Object> result = new HashMap<>();

        ArtRec artRecreq1 = new ArtRec();
        artRecreq.setConfig(sa.getId());
        artRecreq.setAccountId(goodsInfoAndAttrValueDto.getId());
        List<ArtRec> artRecs1 = artRecMapper.selectArtRecList(artRecreq1);
        artRecMapper.deleteArtRecById(artRecs1.get(0).getId());
        if (!"true".equals(resultJson.getString("success"))) {
            result.put("code", 500);
        } else {
            result.put("code", 200);
        }

        result.put("req", JSONObject.toJSONString(paramReq));
        result.put("res", response);
        result.put("msg", resultJson.getString("data"));
        return AjaxResult.success(result);
    }


    public static void main(String[] args) {

//        String appKey = "yuduwangluo";
//        String appSecret = "kbcyRN68obBkdwXIbwZ7eRks14tM1AsI";
//        String version = "1.0";
//        String timestamp = String.valueOf(new Date().getTime() / 1000);
//
//        params.put("appKey", appKey);
//        params.put("timestamp", timestamp);
//        params.put("version", version);
//        params.put("paramJson", "");

//        String baseUrl = "http://test-www.leishenshangcheng.com/webapi";
//        String getFameList = "/apiProduct/getGameList";
        Map<String, Object> params = new LinkedHashMap<>();
        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);


//        String response = HttpUtils.doPostForm(baseUrl + getFameList, params, header);

        // {"retTime":"2023-03-07 21:13:18","success":true,"trackId":"b70477cea4104067a80753c5fd242b83","retData":[{"gameType":2,"gameName":"王者荣耀","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581266/1204/王者荣耀.webp","headWord":"W","hotStatus":1,"id":67,"sort":100,"gameOtherName":"王者/WZRY/WZ"},{"gameType":1,"gameName":"和平精英","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581445/6582/和平精英.webp","headWord":"H","hotStatus":1,"id":68,"sort":99,"gameOtherName":"和平/HP"},{"gameType":2,"gameName":"原神","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581439/8129/原神.webp","headWord":"Y","hotStatus":1,"id":69,"sort":97,"gameOtherName":""},{"gameType":1,"gameName":"地下城与勇士","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581426/182/DNF.webp","headWord":"D","hotStatus":1,"id":70,"sort":96,"gameOtherName":"DNF/dnf"},{"gameType":1,"gameName":"英雄联盟","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677641969/248/8pqgxt.jpg","headWord":"Y","hotStatus":1,"id":71,"sort":95,"gameOtherName":"lol/LOL/撸啊撸"},{"gameType":2,"gameName":"穿越火线","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581410/6232/6aprxa.jpg","headWord":"C","hotStatus":1,"id":72,"sort":94,"gameOtherName":"CF"},{"gameType":2,"gameName":"枪战王者","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581397/882/枪战王者.webp","headWord":"Q","hotStatus":1,"id":73,"sort":93,"gameOtherName":"CFM/cfm"},{"gameType":2,"gameName":"火影忍者","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581390/2553/火影.webp","headWord":"H","hotStatus":1,"id":74,"sort":92,"gameOtherName":"火影"},{"gameType":1,"gameName":"绝地求生","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1675655749/1228/u3nuf6.png","headWord":"J","hotStatus":1,"id":75,"sort":91,"gameOtherName":"吃鸡/PUBG/pubg"},{"gameType":1,"gameName":"永劫无间","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581378/7710/永劫无间.webp","headWord":"Y","hotStatus":1,"id":76,"sort":90,"gameOtherName":"永劫"},{"gameType":1,"gameName":"Apex英雄","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581370/1666/Apex.webp","headWord":"A","hotStatus":1,"id":77,"sort":89,"gameOtherName":"APEX/apex"},{"gameType":2,"gameName":"光遇","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677641848/2704/bw2n1y.jpg","headWord":"G","hotStatus":1,"id":78,"sort":88,"gameOtherName":""},{"gameType":2,"gameName":"三国杀","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581355/9843/三国杀.webp","headWord":"S","hotStatus":1,"id":79,"sort":87,"gameOtherName":""},{"gameType":2,"gameName":"第五人格","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581348/737/第五人格.webp","headWord":"D","hotStatus":1,"id":80,"sort":86,"gameOtherName":""},{"gameType":2,"gameName":"QQ飞车手游","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581337/6841/QQ飞车手游.webp","headWord":"Q","hotStatus":1,"id":81,"sort":85,"gameOtherName":""},{"gameType":2,"gameName":"香肠派对","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581328/7549/香肠派对.webp","headWord":"X","hotStatus":1,"id":82,"sort":84,"gameOtherName":""},{"gameType":2,"gameName":"蛋仔派对","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581320/5013/蛋仔派对.webp","headWord":"D","hotStatus":1,"id":83,"sort":83,"gameOtherName":""},{"gameType":2,"gameName":"金铲铲之战","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581309/1231/19aoot.jpg","headWord":"J","hotStatus":1,"id":84,"sort":82,"gameOtherName":""},{"gameType":2,"gameName":"LOL手游","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581301/838/lr3qp8.jpg","headWord":"L","hotStatus":1,"id":85,"sort":81,"gameOtherName":"英雄联盟手游"},{"gameType":1,"gameName":"天涯明月刀","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581293/7222/ffud66.png","headWord":"T","hotStatus":-1,"id":86,"sort":80,"gameOtherName":"天刀"},{"gameType":1,"gameName":"逆战","createTime":"2023-02-28 17:54:43","gameUrl":"https://test1-dfs01.nn.com/v2/default/1677581283/4044/逆战.webp","headWord":"N","hotStatus":-1,"id":87,"sort":79,"gameOtherName":"NZ"},{"gameType":1,"gameName":"和平精英1","createTime":"2023-03-02 09:45:25","gameUrl":"https://test1-dfs01.nn.com/v2/default/1675670324/2713/8wx20l.jpg","headWord":"H","hotStatus":1,"id":88,"sort":101,"gameOtherName":"吃鸡游戏"},{"gameType":2,"gameName":"球球大作战","createTime":"2023-03-06 15:05:51","gameUrl":"https://test1-dfs01.nn.com/v2/default/1678086346/9339/d156jh.png","headWord":"Q","hotStatus":-1,"id":89,"sort":80,"gameOtherName":"球球"}],"retCode":"100","retMsg":"操作成功"}
//
        String getServerAreaList = "/apiProduct/getServerAreaList";
          String getGameList ="/apiProduct/getGameList";
        String attrListByGameId = "/apiProduct/attrListByGameId";
        String delAll = "/apiProduct/delAll";
//
        JSONObject paramJson = new JSONObject();
        paramJson.put("goodsNo", "68");
        paramJson.put("gameId", "73");
        params.put("paramJson", JSONObject.toJSONString(paramJson));
//        String appKey = "yuduwangluo";
        String appKey = "dianjingmao"; //电竞猫
        System.out.println(appKey.length());
        String appSecret = "Myy9bpyohxrpHde2zMHQ8UT6LE0FbDLc"; //电竞猫
//        String appSecret = "hPMzqUp1JRsPxZyzOQVAkpSz8JBpekOV";
//        String appSecret = "kbcyRN68obBkdwXIbwZ7eRks14tM1AsI";
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        String version = "1.0";
//        String paramJson = "{\"goodsTitle\":\"啊飞洒发生发生发生阿斯弗萨芬\",\"goodsDesc\":\"啊飞洒发生发生发生阿斯弗萨芬\",\"goodsPicList\":[{\"picUrl\":\"https://game.ikbh.top/ff8080818529057301852a73a7660c381.jpg\",\"sort\":0},{\"picUrl\":\"https://game.ikbh.top/ff8080818529057301852a7407400c3f2.jpg\",\"sort\":1},{\"picUrl\":\"https://game.ikbh.top/ff80808185290a0801852a74071f07993.jpg\",\"sort\":2}],\"imgUrl\":\"https://game.ikbh.top/ff8080818529057301852a73a7660c381.jpg\",\"gameAccount\":\"111111\",\"salePrice\":650.00,\"subLinePrice\":780.000,\"gameId\":\"67\",\"systemId\":\"65\",\"gameSysId\":\"65\",\"gameServerId\":\"55\",\"gameName\":\"【皮肤数量 140英雄数量 101】\",\"goodsAttrList\":[{\"gameParentAttrId\":217,\"gameChildAttrId\":\"221\"},{\"gameChildAttrValue\":\"140\",\"gameParentAttrId\":212},{\"gameParentAttrId\":207,\"gameChildAttrId\":\"209\"},{\"gameChildAttrValue\":\"140\",\"gameParentAttrId\":202},{\"gameParentAttrId\":199,\"gameChildAttrId\":\"201\"},{\"gameParentAttrId\":196,\"gameChildAttrId\":\"197\"},{\"gameParentAttrId\":142,\"gameChildAttrId\":\"175,172,147,146,169,175,148,164\"},{\"gameParentAttrId\":28,\"gameChildAttrId\":\"41,49,54,34,36,127\"},{\"gameParentAttrId\":16,\"gameChildAttrId\":\"17,18\"},{\"gameParentAttrId\":1,\"gameChildAttrId\":\"3,4\"}],\"compensation\":\"1\",\"channelProductCode\":977,\"goodsType\":\"0\",\"qty\":\"1\"}";
        String algSign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(paramJson));
        System.out.println(algSign);
        params.put("sign", algSign);
        params.put("appKey",appKey);
        params.put("timestamp",timestamp);
        params.put("version","1.0");
//        params.put("paramJson",paramJson);

        System.out.println(JSONObject.toJSONString(params));

//
        String response = HttpUtils.doPostForm("https://www.leishenshangcheng.com/webapi" + getServerAreaList, params, header);
//
        System.out.println(response);
    }

    public JSONObject getGameServices(String gameId){

        Map<String, Object> params = new LinkedHashMap<>();
        Map<String, Object> header = new HashMap<>();
        header.put("reqChannel", 4);
        String getServerAreaList = "/apiProduct/getServerAreaList";
        JSONObject paramJson = new JSONObject();
        paramJson.put("gameId", "70");
        params.put("paramJson", JSONObject.toJSONString(paramJson));
        String appKey = "dianjingmao"; //电竞猫
        String appSecret = "Myy9bpyohxrpHde2zMHQ8UT6LE0FbDLc"; //电竞猫
        String timestamp = String.valueOf(new Date().getTime() / 1000);
        String version = "1.0";
        String algSign = algSign(appKey, appSecret, timestamp, version, JSONObject.toJSONString(paramJson));
        System.out.println(algSign);
        params.put("sign", algSign);
        params.put("appKey",appKey);
        params.put("timestamp",timestamp);
        params.put("version","1.0");
        String response = HttpUtils.doPostForm("https://www.leishenshangcheng.com/webapi" + getServerAreaList, params, header);
        return JSONObject.parseObject(response);
    }
    public static String algSign(String appKey, String appSecret, String timestamp, String version, String paramJson) {
        StringBuilder sf = new StringBuilder();
        sf.append(appSecret);
        sf.append("appKey");
        sf.append(appKey);
        sf.append("paramJson");
        sf.append(paramJson);
        sf.append("timestamp");
        sf.append(timestamp);
        sf.append("version");
        sf.append(version);
        sf.append(appSecret);
        String algSign = DigestUtils.md5Hex(sf.toString());
        log.info("计算签名结果:{}", algSign);
        return algSign;
    }

}
